Class: Plan
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Plan
show all
- Defined in:
- app/models/plan.rb
Constant Summary
collapse
- BILLING_PERIODS =
["Monthly", "Annually"]
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
28
29
30
31
32
33
34
|
# File 'app/models/plan.rb', line 28
def method_missing(method, *args)
if has_dynamic_attribute?("field_#{method}")
return self.send("field_#{method}")
end
super
end
|
Instance Method Details
#respond_to?(method_sym, include_private = false) ⇒ Boolean
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/models/plan.rb', line 14
def respond_to?(method_sym, include_private = false)
@column_names = []
unless dynamic_attributes.nil?
dynamic_attributes.each do |dm|
@column_names << dm[0].gsub("field_", "")
end
if @column_names.include? method_sym.to_s
return true
end
end
super
end
|