Simplest one:
attr_accessor :variable_name # this will generate get and set method for
you
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 via http://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
-~----------~----~----~----~------~----~------~--~---