Ruby on Rails Monday, August 29, 2011

7stud -- wrote in post #1018959:

There are no partials involved I

> @user is an ActiveRecord::Base object, so
> the errors() method must be defined in that class or one of that class's
> parent classes (or in a module that one of those classes includes).

Ok I gather that to use p.errors.full_messages I need

def initialize
@errors = ActiveModel::Errors.new(self)
end

From http://api.rubyonrails.org/classes/ActiveModel/Errors.html

But if I do it throws up 'You have a nil object when you didn't expect
it!' in relation to

<%= form_for @user, :html => {:multipart => true} do |f| %>

I have attached the relevant files.

Am I on the right track now?

Attachments:
http://www.ruby-forum.com/attachment/6561/new.html.erb
http://www.ruby-forum.com/attachment/6562/user.rb


--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment