DangerousAttributeError

I upgraded to rails 2.0.2 so i get this error ActiveRecord::DangerousAttributeError in Asset#show

this is in the view <div class="price"><%=h shekels_to_dollars(@asset.price_shekel, options = {:precision => 0}) %></div>

when i delete this line every thing is ok

This is in application helper #Converts a shekels amount to a dollar amount and outputs as a currency.   def shekels_to_dollars (amount_in_shekels, options = {})     @dollar = Rate.find(1).rate     if amount_in_shekels       amount_in_dollars = amount_in_shekels.to_f / @dollar.to_f     return number_to_currency(amount_in_dollars, options)     end   end

this is the db table class CreateRates < ActiveRecord::Migration   def self.up     create_table :rates do |t|     t.column :name, :string     t.column :rate, :float, :default => 0     t.column :update, :date     t.column :updated_at, :datetime     end   end

  def self.down     drop_table :rates   end end

Please help

Raised when attribute has a name reserved by Active Record (when attribute has name of one of Active Record instance methods).

In your case that's most likely the "update" attribute, since it would overwrite ActiveRecords update method

Thanks Thorsten

Is renaming the attribute at the database level the only option to work around this issue?

At work we have similar situation where many other applications/ platforms make use of the same database table so changing the schema
incurs more risk that simply ensuring that the Rails App can play
along so when it's not possible to change the column name on a table
how do you fix this issue?

For instance how do you map an accessor from a column in the db that
clashes with an existing method provided by ActiveRecord::Base?

Hi Robert,