Class: SupportUtils::Core::ActiveRecord::Utils
- Inherits:
-
Object
- Object
- SupportUtils::Core::ActiveRecord::Utils
- Defined in:
- lib/support_utils/core/active_record/utils.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
- #helpers ⇒ Object (also: #h)
-
#initialize(model) ⇒ Utils
constructor
A new instance of Utils.
- #parse_time(time) ⇒ Object
- #time_zone ⇒ Object
Constructor Details
#initialize(model) ⇒ Utils
Returns a new instance of Utils.
8 9 10 11 |
# File 'lib/support_utils/core/active_record/utils.rb', line 8 def initialize model raise ArgumentError, ":model must be a subclass of ActiveRecord::Base" unless model.class < ::ActiveRecord::Base @model = model end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
6 7 8 |
# File 'lib/support_utils/core/active_record/utils.rb', line 6 def model @model end |
Instance Method Details
#helpers ⇒ Object Also known as: h
17 18 19 |
# File 'lib/support_utils/core/active_record/utils.rb', line 17 def helpers ActionController::Base.helpers end |
#parse_time(time) ⇒ Object
23 24 25 |
# File 'lib/support_utils/core/active_record/utils.rb', line 23 def parse_time time time_zone.parse(time) rescue nil end |
#time_zone ⇒ Object
13 14 15 |
# File 'lib/support_utils/core/active_record/utils.rb', line 13 def time_zone Time.zone end |