pizzaria
pizzaria copied to clipboard
Project used for Chapter 14 of "Beginning Rails 3"
-
Devise
-
Adding to Gemfile: gem 'devise', '1.1.rc0' (run 'bundle install' after this)
-
Update development.rb: config.action_mailer.default_url_options = { :host => 'localhost:3000' }
-
Remove activatable
-
Defining root path: root :to => "users#new"
-
Generating User model: 'rails generate devise User'
-
Add admin boolean field
- rails generate migration AddAdminToUsers admin:boolean
-
URLS
- http://localhost:3000/users/registration/sign_up
- http://localhost:3000/users/sign_in
-
-
Models
-
rails generate model Order user_id:integer total:decimal delivery_method:string address:string
-
rails generate model OrderItem order_id:integer product_id:integer quantity:integer
-
rails generate scaffold Product name:string description:string tip:string category:string price:decimal
-
Seed file, some products and an Admin user
-
-
Associations
- Order / Product / User / OrderItem
-
Adding logic methods
-
Installing Paperclip
- rails generate migration AddImageToProducts image_file_name:string image_content_type:string image_file_size:integer image_updated_at:datetime
-
Controller
- Products (Scaffolded)
- Only admin should edit/update/create/delete
- Carts with updating Application Controller (current_cart)
- add and remove
- Orders
- index => admin ? all : my
- new => has the shipping method and the address fields
- show / create
- reorder => Order.new(@order.clone)
- Pages
- index / about
- Products (Scaffolded)
-
Update the application layout
- sidebar with cart view
- render Login/logout in the sidebar/header
- Product partial with 'add to cart'
- Show order page
- show cart page
-
Routes
- Root is to pages#index
-
Active Merchant
-
Ideas with directions.
- Dynamic categories (belongs_to and has_many)
- Add extra fields to Order item - Customize size
- Search functionality - SimpleSearch plugin
- Email a friend
- Reorder
-
My orders
-
Pagination for products/orders [Done]