ruby on rails - NoMethodError in Home#index -


Please help me I'm not sure that I have a problem with route or plural, but this error occurs and Now do not know what to do, already many places were researched and nothing else.

I started a mini tutorial and it works, login works so I want to use it again and create a to-do list.

When I put a partial render, where I would like it to be in the fields to make a to-do list, then it happens:

ActionView :: Template :: Error (Undefined method `model_name 'for NilClass: Category): 1: & lt;% = form_for (@todo_list) | F | & Gt%; 2: & lt;% if @todo_list.errors.any? & Gt%; 3: & lt; Div id = "error_explanation" & gt; 4: & lt; H2 & gt; & Lt;% = plural (@ todo_list.errors.count, "error")%> This todo_list was restricted from saving: & lt; / H2 & gt;

Route:

Match 'Dashboard' = & gt; 'Home # Dashboard' match 'register' = & gt; 'Registration # Register' Route: From = & gt; "Home # index '
  new_member_session /members/sign_in(.:format GET) will / Session # New member_session post /members/sign_in(.:format) will / session # destroy_member_session /members/sign_out(.:format dELETE) will / session # member_password post make /members/password(.:format deleted) will get / password # new_member_password /members/password/new(.:format) will / password # new edit_member_password get /members/password/edit(.:format) will / password # edit PUT /members/password(.:format) will / password # updated cancel_member_registration get /members/cancel(.:format) Registration # Canceled member_registration post /members(.:form at) Registration # new_member_registration get /members/sign_up(.:format) Registration # New /members/edit(.:format get edit_member_registration) registr practical # edit PUT /members(.:format) Registration # delete update / members (. : format) Registration # dashboard /dashboard(.:format deleted) house # dashboard register /register(.:format) Registration # Registration root / home # index  

model:

Class ToDoList & lt; ActiveRecord :: Base attr_accessible: is_favorite ,: name ,: details has_many: tasks, depending destroyed belongs_to: Members

controller:

  class ToDoListController to & Lt; ApplicationController def indices @todo_lists = ToDoList.all response_to do | Format | Format.html # index.html.erb format.json {render json: @todo_lists} End end DEF @todo_list = toDoList.new response_to do format | Format.html # new.html.erb format.json {render json: @todo_list} End End  

Try:

To change the name of the controller:

Class ToDoListsController

Also change your filename and directory names accordingly.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -