Class: Daylite::Base

Inherits:
ActiveRecord::Base show all
Defined in:
app/models/daylite.rb

Instance Method Summary collapse

Methods inherited from ActiveRecord::Base

openbase_connection

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/models/daylite.rb', line 18

def method_missing(symbol, *args)
  guess_attribute = symbol.to_s.camelize(:lower).sub("Id", "ID")
  if result = attributes[guess_attribute]
    self.class.class_eval do
      define_method symbol do
        return attributes[guess_attribute]
      end
    end
    result
  else
    super
  end
end

Instance Method Details

#readonly?Boolean

don’t allow to save Daylite::Base objects to DB

Returns:

  • (Boolean)


14
15
16
# File 'app/models/daylite.rb', line 14

def readonly?
  true
end