Class: ActivePresenter::Base
- Includes:
- ActionController::UrlWriter, ActionView::Helpers::FormHelper, ActionView::Helpers::FormOptionsHelper, ActionView::Helpers::FormTagHelper, ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, ActionView::Helpers::UrlHelper
- Defined in:
- lib/base.rb
Instance Attribute Summary collapse
-
#model_camelcase ⇒ Object
> DebateSide.
-
#model_underscore ⇒ Object
> debate_side.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(source, options = {}) ⇒ Base
constructor
A new instance of Base.
- #model ⇒ Object
Constructor Details
#initialize(source, options = {}) ⇒ Base
Returns a new instance of Base.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/base.rb', line 26 def initialize(source, = {}) self.model_underscore = source.class.to_s.underscore self.model_camelcase = source.class.to_s eval %{alias :#{self.model_underscore} :model} @model = source self. = || {} if source.is_a? ActiveRecord::Base if source.is_restful? build_common_ar_resource_methods build_ar_resource_methods else #build_ar_non_resource_methods end end end |
Instance Attribute Details
#model_camelcase ⇒ Object
> DebateSide
24 25 26 |
# File 'lib/base.rb', line 24 def model_camelcase @model_camelcase end |
#model_underscore ⇒ Object
> debate_side
23 24 25 |
# File 'lib/base.rb', line 23 def model_underscore @model_underscore end |
#options ⇒ Object
Returns the value of attribute options.
22 23 24 |
# File 'lib/base.rb', line 22 def @options end |
Instance Method Details
#model ⇒ Object
42 43 44 |
# File 'lib/base.rb', line 42 def model @model end |