-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c4a810
commit bd32442
Showing
18 changed files
with
131 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,55 @@ | ||
source "https://rubygems.org" | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org' | ||
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | ||
|
||
ruby "3.1.2" | ||
ruby '3.1.2' | ||
|
||
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" | ||
gem "rails", "~> 7.0.3" | ||
gem 'rails', '~> 7.0.3' | ||
|
||
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] | ||
gem "sprockets-rails" | ||
gem 'sprockets-rails' | ||
|
||
# Use postgresql as the database for Active Record | ||
gem "pg", "~> 1.1" | ||
gem 'pg', '~> 1.1' | ||
|
||
# Use the Puma web server [https://github.com/puma/puma] | ||
gem "puma", "~> 5.0" | ||
gem 'puma', '~> 5.0' | ||
|
||
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails] | ||
gem "importmap-rails" | ||
gem 'importmap-rails' | ||
|
||
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev] | ||
gem "turbo-rails" | ||
gem 'turbo-rails' | ||
|
||
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev] | ||
gem "stimulus-rails" | ||
gem 'stimulus-rails' | ||
|
||
# Build JSON APIs with ease [https://github.com/rails/jbuilder] | ||
gem "jbuilder" | ||
gem 'jbuilder' | ||
|
||
# Devise Auth | ||
gem "devise", "~> 4.8.1" | ||
gem 'devise', '~> 4.8.1' | ||
|
||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem | ||
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ] | ||
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] | ||
|
||
# Reduces boot times through caching; required in config/boot.rb | ||
gem "bootsnap", require: false | ||
gem 'bootsnap', require: false | ||
|
||
group :development, :test do | ||
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem | ||
gem "debug", platforms: %i[ mri mingw x64_mingw ] | ||
gem 'debug', platforms: %i[mri mingw x64_mingw] | ||
end | ||
|
||
group :development do | ||
# Use console on exceptions pages [https://github.com/rails/web-console] | ||
gem "web-console" | ||
gem 'web-console' | ||
|
||
# Static analyzers, linters and similar | ||
gem "brakeman", "~> 5.3.1" | ||
gem "rubocop", "~> 1.36.0" | ||
gem "rubocop-rails", "~> 2.16.0" | ||
gem "lefthook", "~> 1.1.1" | ||
gem 'brakeman', '~> 5.3.1' | ||
gem 'lefthook', '~> 1.1.1' | ||
gem 'rubocop', '~> 1.36.0' | ||
gem 'rubocop-rails', '~> 2.16.0' | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require_relative "config/application" | ||
require_relative 'config/application' | ||
|
||
Rails.application.load_tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module ApplicationCable | ||
class Channel < ActionCable::Channel::Base | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module ApplicationCable | ||
class Connection < ActionCable::Connection::Base | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
class ApplicationController < ActionController::Base | ||
def is_customer? | ||
current_user && current_user.customer? | ||
current_user&.customer? | ||
end | ||
|
||
def is_manager? | ||
current_user && current_user.manager? | ||
current_user&.manager? | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
module ApplicationHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
module CinemaHallsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
module MoviesHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
class ApplicationMailer < ActionMailer::Base | ||
default from: "[email protected]" | ||
layout "mailer" | ||
default from: '[email protected]' | ||
layout 'mailer' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
class ApplicationRecord < ActiveRecord::Base | ||
primary_abstract_class | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
class User < ApplicationRecord | ||
# Include default devise modules. Others available are: | ||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable | ||
devise :database_authenticatable, :registerable, | ||
:recoverable, :rememberable, :validatable | ||
|
||
enum :role, [:customer, :manager] | ||
enum :role, %i[customer manager] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
# This file is used by Rack-based servers to start the application. | ||
|
||
require_relative "config/environment" | ||
require_relative 'config/environment' | ||
|
||
run Rails.application | ||
Rails.application.load_server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,81 @@ | ||
# frozen_string_literal: true | ||
|
||
Hall.destroy_all | ||
|
||
Hall.create!([ | ||
{ | ||
name: "A1", | ||
capacity: 20 | ||
}, | ||
{ | ||
name: "B1", | ||
capacity: 50 | ||
}, | ||
{ | ||
name: "B2", | ||
capacity: 50 | ||
}, | ||
{ | ||
name: "B3", | ||
capacity: 50 | ||
}, | ||
{ | ||
name: "B4", | ||
capacity: 50 | ||
}, | ||
{ | ||
name: "C1", | ||
capacity: 100 | ||
}, | ||
{ | ||
name: "C2", | ||
capacity: 100 | ||
}, | ||
{ | ||
name: "C3", | ||
capacity: 100 | ||
}, | ||
{ | ||
name: "C4", | ||
capacity: 100 | ||
}, | ||
{ | ||
name: "D1", | ||
capacity: 200 | ||
} | ||
]) | ||
{ | ||
name: 'A1', | ||
capacity: 20 | ||
}, | ||
{ | ||
name: 'B1', | ||
capacity: 50 | ||
}, | ||
{ | ||
name: 'B2', | ||
capacity: 50 | ||
}, | ||
{ | ||
name: 'B3', | ||
capacity: 50 | ||
}, | ||
{ | ||
name: 'B4', | ||
capacity: 50 | ||
}, | ||
{ | ||
name: 'C1', | ||
capacity: 100 | ||
}, | ||
{ | ||
name: 'C2', | ||
capacity: 100 | ||
}, | ||
{ | ||
name: 'C3', | ||
capacity: 100 | ||
}, | ||
{ | ||
name: 'C4', | ||
capacity: 100 | ||
}, | ||
{ | ||
name: 'D1', | ||
capacity: 200 | ||
} | ||
]) | ||
|
||
p "Successfully created #{Hall.count} Halls" | ||
Rails.logger.debug { "Successfully created #{Hall.count} Halls" } | ||
|
||
Movie.destroy_all | ||
|
||
Movie.create!([{ | ||
title: "Avatar", | ||
length_in_minutes: 162 | ||
}, | ||
{ | ||
title: "Titanic", | ||
length_in_minutes: 194 | ||
}, | ||
{ | ||
title: "Gladiator", | ||
length_in_minutes: 155 | ||
}]) | ||
title: 'Avatar', | ||
length_in_minutes: 162 | ||
}, | ||
{ | ||
title: 'Titanic', | ||
length_in_minutes: 194 | ||
}, | ||
{ | ||
title: 'Gladiator', | ||
length_in_minutes: 155 | ||
}]) | ||
|
||
p "Successfully created #{Movie.count} Movies" | ||
Rails.logger.debug { "Successfully created #{Movie.count} Movies" } | ||
|
||
if Rails.env == "development" | ||
if Rails.env.development? | ||
User.destroy_all | ||
|
||
User.create!([{ | ||
email: "[email protected]", | ||
password: "123456", | ||
role: "customer" | ||
}, { | ||
email: "[email protected]", | ||
password: "123456", | ||
role: "manager" | ||
}]) | ||
email: '[email protected]', | ||
password: '123456', | ||
role: 'customer' | ||
}, { | ||
email: '[email protected]', | ||
password: '123456', | ||
role: 'manager' | ||
}]) | ||
|
||
p "Successfully created #{User.count} Users" | ||
Rails.logger.debug { "Successfully created #{User.count} Users" } | ||
end |