Skip to content

Instantly share code, notes, and snippets.

@Maxscores
Last active January 2, 2018 21:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Maxscores/6c233ea4dac58bdc4a2f8ef3167db913 to your computer and use it in GitHub Desktop.
Save Maxscores/6c233ea4dac58bdc4a2f8ef3167db913 to your computer and use it in GitHub Desktop.

Rails_new:

  • rails new project_name -T(no minitest) -d="postgresql" --skip-spring --skip-turbolinks
    • Add rspec-rails, capybara, databasecleaner, and launchy to test gems.
    • Uncomment bcrypt
  • rails g rspec:install
  • Add rails_helper to .rspec
  • What are my features?
  • Build out schema
    • What are my resources?
    • How do they relate?
  • What is my website structure (tree/grid/all connected)
  • Decide what I want views to show
    • Draw out wire-frames for views

Full Crud:

  • Create Migration - rails g migration CreateTable column:type
    • t.timestamps
  • Model
    • Model Test
    • Model Class
    • Model Relationships
  • Add resource to: 'config/routes.rb'
  • Check: 'rails routes'
  • Create Controller
    • Resource Params
  • CRUD
    • index test
    • index view
    • index route
    • show test
    • show view
    • show route
    • new test
    • form view
    • new view
    • new route
    • create route
    • edit test
    • edit view
    • edit route
    • update route
    • delete test
    • delete route

Internal Resources(resource):

  • Create Migration - rails g migration CreateTable column:type
    • t.timestamps
  • Model
    • Model Test
    • Model Class
    • Model Relationships
  • form partial
  • resource partial
  • Add resource to: 'config/routes.rb' only: [:create]
  • Check: 'rails routes'
  • Update Parent Controller
    • Pass in @resource
  • Create Controller
    • Resource Params
    • create action
  • Feature Tests (in parent view test)
    • Form creates
    • View parts

Namespacing:

  • scope :admin, module: :admin, as: :admin do resources :resource end
  • or namespace :admin do resources :resource end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment