class Ruxero::BaseModel

  cattr_reader :_fields
  @@_fields = Hash.new

  def self.accessor(name, options = {})
    @@_fields[name.to_sym] = options
    attr_accessor name.to_sym
  end

  def self.readonly(name, options = {})
    @@_fields[name.to_sym] = options
    attr_reader name.to_sym
  end

  def initialize(attributes = {})
    super
    _set_attributes(attributes)
  end

  private

  def _set_attributes(attributes)
    attributes.each do |key, value|
      self.send("#{key}=", value)
    end
  end

end

class Ruxero::BaseModel

  cattr_reader :_fields
  @@_fields = Hash.new

  def self.accessor(name, options = {})
    @@_fields[name.to_sym] = options
    attr_accessor name.to_sym
  end

  def self.readonly(name, options = {})
    @@_fields[name.to_sym] = options
    attr_reader name.to_sym
  end

  def initialize(attributes = {})
    _set_attributes(attributes)
  end

  private

  def _set_attributes(attributes)
    attributes.each do |key, value|
      self.send("#{key}=", value)
    end
  end

end

Fix error when initializing models The BaseModel class doesn't inherit from anything so super was an erroneous call
Fix error when initializing models
The BaseModel class doesn't inherit from anything so super was an erroneous call
