Class: ActivePresenter::Base
- Includes:
- ActionController::UrlWriter, ActionView::Helpers::ActiveRecordHelper, ActionView::Helpers::AssetTagHelper, ActionView::Helpers::BenchmarkHelper, ActionView::Helpers::CacheHelper, ActionView::Helpers::DateHelper, ActionView::Helpers::FormHelper, ActionView::Helpers::FormOptionsHelper, ActionView::Helpers::FormTagHelper, ActionView::Helpers::JavaScriptHelper, ActionView::Helpers::JavaScriptMacrosHelper, ActionView::Helpers::NumberHelper, ActionView::Helpers::PaginationHelper, ActionView::Helpers::PrototypeHelper, ActionView::Helpers::ScriptaculousHelper, ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, ActionView::Helpers::UrlHelper
- Defined in:
- lib/active_presenter_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.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/active_presenter_base.rb', line 36 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
34 35 36 |
# File 'lib/active_presenter_base.rb', line 34 def model_camelcase @model_camelcase end |
#model_underscore ⇒ Object
> debate_side
33 34 35 |
# File 'lib/active_presenter_base.rb', line 33 def model_underscore @model_underscore end |
#options ⇒ Object
Returns the value of attribute options.
32 33 34 |
# File 'lib/active_presenter_base.rb', line 32 def @options end |
Instance Method Details
#model ⇒ Object
52 53 54 |
# File 'lib/active_presenter_base.rb', line 52 def model @model end |