-
Notifications
You must be signed in to change notification settings - Fork 0
Database migrations
Akash Devaraju edited this page Jan 22, 2016
·
10 revisions
rails generate model user name image address
rails generate model chef name email rating:float address
rails generate model review description rating:float
rails generate model menu chef_id:integer name max_capacity:integer min_capacity:integer
rails generate model menu_item menu_id:integer name menu_items_category_id:integer
rails generate model menu_items_category name
rails generate model cuisine name description
rails generate model event_cuisine menu_id:integer cuisine_id:integer
rails generate model booking menu_id user_id
rails generate migration add_auth_token_to_users
db/migrate/20140326204628_add_auth_token_to_users.rb
class AddAuthTokenToUsers < ActiveRecord::Migration
def self.up
change_table :users do |t|
t.string :authentication_token
end
add_index :users, :authentication_token, :unique => true
end
def self.down remove_column :users, :authentication_token end end
rails generate model price menu_id json_for_chef_and_customer_price??
Chef.rb
has_many :menus
has_many :bookings, through: :menus
has_many :reviews
Review.rb
belongs_to :chef
Menu.rb
belongs_to :chef
has_many :bookings
has_many :menu_items
has_many :cuisines, through: :event_cuisine
Cuisine.rb
has_many :menus, through: :event_cuisine
Event_cuisine.rb
belongs_to :cuisine
belongs_to :menu
Menu_items.rb
belongs_to :menu
belongs_to :menu_items_category
Menu_items_category.rb
has_many :menu_items
Booking.rb
belongs_to :menu
rails g devise_token_auth:install User auth
We are authenticating user based on two scenarios – If user is logged on to the web app then use the same session – If session is not available and auth token is passed then find user based on the token