How to implement get and set method in ruby on rails

please help

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 E.
<[email protected]

On Sep 9, 10:15Â am, Abhinav S. [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