$ cd grocRB $ bundle install# Update Gemfile: set sqlite3 for dev/test and pg for production. Use debugger gem. Use haml set static pages $ vim app/controllers/pages_controller.rb class PagesController < ApplicationController $ vim app/views/pages/home.html.hamldef home end def about end def contact end end %h1 hi! $ vim config/routes.rb root 'pages#home' OR root :to => redirect('/movies') match '/home', to: 'pages#home', via: :GET match '/about', to: 'pages#about', via: :GET match '/contact', to: 'pages#contact', via: :GET $ git init . $ git remote add origin git@github.com:mshahriarinia/grocRB.git$ heroku create $ git remote add heroku git@heroku.com:pure-tundra-4301.git # gem install heroku $ git push heroku master Add stuff for product type $ vim config/routes.rb resources :product_types $ rake routes$ vim app/controllers/product_types_controller.rb class ProductTypesController < ApplicationController def show end def index end def new end def create end def edit end def update end def destroy end end $ rails generate migration product_types create_table :product_types do |t| t.string :name t.string :brand t.text :description t.timestamps end $ rake db:migrate for css file to take effect convert application.html.erb to application.html.haml !!! 5 %html %head %title Rotten Potatoes! = stylesheet_link_tag 'application' = javascript_include_tag 'application' = csrf_meta_tags %body %h1.title Rotten Potatoes! #main - if flash[:notice] #notice.message= flash[:notice] - elsif flash[:warning] #warning.message= flash[:warning] = yield put all your style sheets in app/assets/stylesheets/application.css.scss html, body { margin: 0; padding: 0; background: White; color: DarkSlateGrey; font-family: Tahoma, Verdana, sans-serif; font-size: 10pt; } div#main { margin: 0; padding: 0 20px 20px; } a { background: transparent; color: maroon; text-decoration: underline; font-weight: bold; } h1 { color: maroon; font-size: 150%; font-style: italic; display: block; width: 100%; border-bottom: 1px solid DarkSlateGrey; } h1.title { margin: 0 0 1em; padding: 10px; background-color: orange; color: white; border-bottom: 4px solid gold; font-size: 2em; font-style: normal; } table#movies { margin: 10px; border-collapse: collapse; width: 100%; border-bottom: 2px solid black; } table#movies th { border: 2px solid white; font-weight: bold; background-color: wheat; } table#movies th, table#movies td { padding: 4px; text-align: left; } #notice #warning { background: rosybrown; margin: 1em 0; padding: 4px; } form label { display: block; line-height: 25px; font-weight: bold; color: maroon; } table#movies th.hilite { background-color: yellow; } heroku not loading css?: vim environments/production.rb
========================== make sure to edit db/seeds.rb and $ rake db:seed let product desciptions to be markdown. maybe remove brand?? rake db:migrate:reset that just runs rake db:drop db:create db:migrate . If you're wanting to seed a fresh database, you can just run rake db:reset db:seed
----------- for foreign key make sure to add _id eveywhere and belongs to in model http://stackoverflow.com/questions/14034844/create-association-between-two-instancied-objects
Authentication and session hijacking |