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

On 8 February 2011 12:00, Tushar G. [email protected] wrote:

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}}
    "

I believe this is an internationalisation problem. I don’t know the
details as I don’t use Internationalisation, but hopefully this will
send you down the right track.

Colin

Are you saying it is due to gem “i18n”.

Thanks,
Tushar

Hi,
After uninstalling the “i18n” gem it is working fine.

Thanks,
Tushar

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs