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

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