Hello,
I have a freeze field in a table (that I can''t change).
When I try to find a record in this table I have the exception :
C:/DATA/InstantRails-2.0/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.1.0/lib/active_record/attribute_methods.rb:104:in
`instance_method_already_implemented?''
C:/DATA/InstantRails-2.0/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.1.0/lib/active_record/attribute_methods.rb:72:in
`define_attribute_methods''
C:/DATA/InstantRails-2.0/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.1.0/lib/active_record/attribute_methods.rb:71:in `each''
C:/DATA/InstantRails-2.0/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.1.0/lib/active_record/attribute_methods.rb:71:in
`define_attribute_methods''
C:/DATA/InstantRails-2.0/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.1.0/lib/active_record/attribute_methods.rb:238:in
`method_missing''
any idea to avoid the problem?
Is it possible to change the name of the attribute in the active
record class ?
Many thanks!
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On Jul 31, 4:20 pm, Christophe <Christophe.Belpa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > > I have a freeze field in a table (that I can''t change). > When I try to find a record in this table I have the exception : >Ruby objects already have a freeze method (it makes the object immutable). The easiest way out is probably to write your own accessor methods: def some_other_name self[:freeze] end def some_other_name= value self[:freeze] = value end Fred --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
Thanks for the answer, but the problem comes frome the freeze method, It throws : ActionView::TemplateError (freeze is defined by ActiveRecord) on line #75 of promo_structural/_promo_v2.rhtml: when I execute any access to my ActiveRecord, even to other attributes Christophe On Jul 31, 5:43 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jul 31, 4:20 pm, Christophe <Christophe.Belpa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > > > I have a freeze field in a table (that I can''t change). > > When I try to find a record in this table I have the exception : > > Ruby objects already have a freeze method (it makes the object > immutable). > > The easiest way out is probably to write your own accessor methods: > > def some_other_name > self[:freeze] > end > > def some_other_name= value > self[:freeze] = value > end > > Fred--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---