model - rails 3- undefined method `events' for nil:NilClass when using accepts_nested_attributes_for -
thanks helping. errors occurs during implementation accepts_nested_attributes_for. get
actionview::template:error (undefined method 'events' nil:class) & nomethoderror in app/views/users/index.html.erb line #12. see files @ https://gist.github.com/726828
in summary user model accepts_nested_attributes_for event class. see gist files. again
in see, don't have @user in index (i suppose users/index), why raise error when tries access nil.events.
in index have @users. may want render partial in users/index each user with
<%= render :partial => "user", :collection => @users %> and create users/_user.html.erb put want show.
by way in partial have access user , not @user
sounds you?
Comments
Post a Comment