Hi !

Just wondering here, because if I define reader methods, then these
aren't used in the forms.

For example, I have this:
class Customer
  def tax_rate
    (read_attribute(:tax_rate) * 100.0).to_i
  end

  def tax_rate=(rate)
    write_attribute(:tax_rate, rate / 100.0)
  end
end

<%= text_field :customer, :tax_rate %>

For 7.5, the value shown on screen is 750.  Of course, I could do:
<%= text_field :customer, :tax_rate, :value => @customer.tax_rate %>

but that gets pretty boring real quick...

So, what is the rationale behind this decision ?  Are the date/time
helpers the ones that need the value_before_type_cast ?

Thanks !
--
François Beausoleil
http://blog.teksol.info/
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to