[Rails] Model validation are not displaying properly
Hi,
I am facing a problem with active record validations.
I have a coupon model, which has following validation:-
#coupon.rb
class Coupon < ActiveRecord::Base
validates_presence_of :vendor_id, :message=>":Select a vendor"
validates_presence_of :coupon_code, :message=>":Coupon code should not
be blank."
end
Validations are working but whenever it gets rendered on browser it is
not showing the actual message. It is showing like as follows:-
"
There were problems with the following fields:
* {{attribute}} {{message}}
* {{attribute}} {{message}}
* {{attribute}} {{message}}
"
Also, I have tried to print the error on console but it does not have
any difference.
My gem list is as follows:-
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (2.3.8)
actionpack (2.3.8)
activerecord (2.3.8)
activeresource (2.3.8)
activesupport (2.3.8)
authorize-net (1.5.2)
i18n (0.5.0)
json (1.4.6)
mechanize (1.0.0)
mysql (2.8.1)
nokogiri (1.4.4)
rack (1.2.1, 1.1.0)
rack-mount (0.6.13)
rack-test (0.5.6)
rails (2.3.8)
railties (3.0.3)
rake (0.8.7)
-----------------------------------------------
Can anyone tell me what is wrong with it.
Thanks,
Tushar
--
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home