Closed jelaniwoods closed 4 years ago
Routes are now written like this:
match("/insert_model", { :controller => "models", :action => "create", :via => "post"}) # READ match("/models", { :controller => "models", :action => "index", :via => "get"}) match("/models/:rt_model_id", { :controller => "models", :action => "show", :via => "get"}) # UPDATE match("/modify_model/:rt_model_id", { :controller => "models", :action => "update", :via => "post"}) # DELETE match("/delete_model/:rt_model_id", { :controller => "models", :action => "destroy", :via => "get"})
Controller actions render like:
respond_to do |format| format.json do render({ :json => @model.as_json }) end format.html do render({ :template => "models/show.html.erb" }) end end
View folders now generate just as the plural model name instead of singular_table_name_templates.
singular_table_name
I made a test repo here
You can also add this to the Gemfile of an existing rails app
Gemfile
gem 'draft_generators', github: 'firstdraft/draft_generators', branch: "jw-use-golden-5-routes"
Then run
rails g draft:resource task name:string due_on:datetime
Routes are now written like this:
Controller actions render like:
View folders now generate just as the plural model name instead of
singular_table_name
_templates.I made a test repo here
You can also add this to the
Gemfile
of an existing rails appThen run