def method_missing(method_id, *arguments)
      a = arguments[0] if arguments and arguments.size > 0
      method = method_id.to_s
      if method =~ /^(.*)(=)$/
        self.instance_variable_set("@#{$1.gsub('_','__')}", a)
      elsif method =~ /^(set_)(.*)$/
        self.instance_variable_set("@#{$2.gsub('_','__')}", a)
      elsif self.instance_variable_defined?("@#{method_id.to_s.gsub('_','__')}")
        self.instance_variable_get("@#{method_id.to_s.gsub('_','__')}") # that will be return instance variable value or nil, handy
      else
        nil
      end
    end
def method_missing(method_id, *arguments)
      a = arguments[0] if arguments and arguments.size > 0
      method = method_id.to_s
      if method =~ /^(.*)(=)$/
        self.instance_variable_set("@#{$1.gsub('_','__')}", a)
      elsif method =~ /^(set_)(.*)$/
        self.instance_variable_set("@#{$2.gsub('_','__')}", a)
      elsif self.instance_variable_defined?("@#{method_id.to_s.gsub('_','__')}")
        self.instance_variable_get("@#{method_id.to_s.gsub('_','__')}") # that will be return instance variable value or nil, handy
      else
        nil
      end
    end
if You use rails older that 2.3  probably  you have to uncomment that method and add "config.gem 'json'" in config/enviroment.rb file
 otherwise to_json method will not work propertly
    # You can pass options to to_json method, but remember that they have no effects!!!
    # argument 'options' is for rails compability
    def to_json(options = {})
      to_hash.to_json
    end
 method_missing handle setting and getting instance variables
 You can set variable in two ways:
 1. variable_name = value
 1. set_variable_name(value)
 you can get only  alredy setted variables, otherwise return nil