Skip to content

Instantly share code, notes, and snippets.

@wh1tney wh1tney/flow.md
Created Aug 28, 2014

Embed
What would you like to do?
Rails Workflow - Getting Started

Rails Workflow

A few simple steps when starting a new Rails project

  • rails new <app_name>

  • Update Gemfile to include gems for testing

    • e.g. RSpec, FactoryGirl, Capybara
     group :development, :test do
     	gem "rspec-rails"	
     end
     
     group :test do
     	gem "capybara"
     	gem "launchy"
     	gem "factory_girl_rails"
     	gem "database_cleaner"
     end
    
  • Generate RSpec stuff

    • bundle exec rails generate rspec:install
  • Generate controller

    • rails generate controller <controller_name>
  • Generate model

    • rails generate model <model_name>
  • Edit controller test (or don't) inside spec/controllers/ directory

    • vim spec/controllers/*_controller_spec.rb
  • Update routes in config/routes.rb

    • get '/jiggy' => 'willenium#dance'
  • Add controller actions (methods) model that satisfy controller test

     def dance
     	@jig = Jig.create(jig_params)
     end
     
     private
     
     def jig_params
     	params.require(:jig).permit(:style, :level)
     end
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.