Hello all.
I have a table "Account" with the "value" column.
How i can change a scope for it, so that is will be only accessable in a
Account class? I''ve tried to overload a method, but no luck:
>> class Account < ActiveRecord::Base
>> private
>> def value=(amount)
>> write_attribute(:value, amount)
>> end
>> end
=> nil>> ll = Account.new
=> #<Account:0xb6ef598c @new_record=true,
@attributes={"name"=>nil, "entity_id"=>nil,
"updated_at"=>nil, "currency_id"=>nil,
"account_group_id"=>nil,
"value"=>#<BigDecimal:b6eafb6c,''0.0'',4
(12)>,
"base_value"=>#<BigDecimal:b6eafa18,''0.0'',4
(12)>, "account_num"=>nil,
"created_at"=>nil}>>> ll.private_methods.include? "value="
=> true>> ll.value = 10
=> 10>> ll.value
=>
#<BigDecimal:b718d064,''0.1E2'',4(8)>>>
--
======================================================================
- Best regards, Nikolay Pavlov. <<<-----------------------------------
======================================================================
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---