Skip to content

Instantly share code, notes, and snippets.

@maslick
Last active July 17, 2018 10:10
Show Gist options
  • Save maslick/037452d101340fb069f0fee3c439d9f1 to your computer and use it in GitHub Desktop.
Save maslick/037452d101340fb069f0fee3c439d9f1 to your computer and use it in GitHub Desktop.
railz cheet sheet
// create new app
rails new haha-app
// create db
rake db:create
// create chapter
rails g scaffold Chapter title:string content:text
// migrate changes
rake db:migrate
// make chapter default route (config/routes.db)
root 'chapters#index'
// add paperclip
gem "paperclip", "~> 6.0.0"
bundle install
// add photos
rails g scaffold Photo title:string chapter:references
rake db:migrate
// add attachment to photo
rails g paperclip photo image
rake db:migrate
// add simple_form
gem 'simple_form'
rails generate simple_form:install
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment