On Sep 9, 10:15 am, Abhinav Saxena <[email protected]> wrote:
> Simplest one:
> attr_accessor :variable_name # this will generate get and set method for
> you
>
But don't do this for database backed attributes - for those the
accessor methods are added for you.
Fred
> If you meant how to write get & set methods for database table column in
> your model:
>
> def column_name
> read_attribute(:column_name) # if column_name is the name of the column
> end
>
> def column_name=(value)
> write_attribute(:column_name, value) # or you can modify value, and
> call super with it. Search on Internet to find more.
> end
>
> Thanks,
> Abhinav
> --
> अभिनवhttp://twitter.com/abhinav
>
> On Wed, Sep 9, 2009 at 2:33 PM, Venkat Eee <[email protected]
>
>
>
> > wrote:
>
> > please help
> > --
> > Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---