Forum: Ruby on Rails RE: possible rails bug? form errors and scoping

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
jviney (Guest)
on 2005-12-09 06:58
(Received via mailing list)
Actually, you need to change another line as well... from:

"#{pluralize(object.errors.count, "error")} prohibited this
#{object_name.to_s.gsub("_", " ")} from being saved"

to:

"#{pluralize(object.errors.count, "error")} prohibited this
#{object.class.to_s.downcase} from being saved"


I guess you do lose a bit of functionality here, because if you had
done...

  @guy = Person.find_by_name('Jim')

And then...
  error_messages_for 'guy'

It would say:
  1 error prohibited this guy from being saved

Whereas now you would only get:
  1 error prohibited this person from being saved

It's probably not a big deal, but just so you know..., I personally like
it the new way, but that's just me. Also, if you had a BadPerson class
it will now say '1 error prohibited this badperson from being saved', so
you might want to reformat it a bit and put a space before each capital
letter.

Cheers, Jonathan
This topic is locked and can not be replied to.