I am fairly new to Ruby and RoR but am making pretty good progress. But
this has me stumped and I wonder if anyone can point me in the right
direction. I haven’t been able to find any examples on the web that
shine the light on this yet.
I have a very simple hasmany :through model as follows:
class Member < ActiveRecord::Base
has_many :member_phones, :dependent => :destroy
has_many :phones, :through => :member_phones
validates_exclusion_of :first_name, :in => [ “Bozo”], :message => “You
don’t belong here”
class MemberPhone < ActiveRecord::Base
validates_exclusion_of :name, :in => [ “Foobar” ], :message => “No
class Phone < ActiveRecord::Base
has_many :people, :through => :member_phones
And this all works fine. The application can do all the CRUD functions,
and the validations really fail when they should.
My problem is that if I enter a phone named Foobar, it will fail to add
the record just as it should, but it does so silently. I cannot figure
out how to display an error message for it.
I can use <%= error_messages_for ‘member’ %> to display the error
message if I add a member with a first name of Bozo, but I can’t figure
out how to get hold of the error message for the phone.
Does anyone know how to get and display the error messages on these