Class: Fob::Fob

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming
Includes:
ActiveModel::Conversion, ActiveModel::Validations
Defined in:
lib/fob/fob.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.has_one(name, options = {}) ⇒ Object



19
20
21
# File 'lib/fob/fob.rb', line 19

def self.has_one(name, options={})
  include_model(name, options)
end

.represents(name, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/fob/fob.rb', line 9

def self.represents(name, options={})
  include_model(name, options)
  klass = name.to_s.split("_").collect(&:capitalize).join
  singleton_class.instance_eval do
    define_method(:model_name) do
      ::ActiveModel::Name.new(self, nil, "#{klass}")
    end
  end
end

Instance Method Details

#persisted?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/fob/fob.rb', line 23

def persisted?
  false
end