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::NumberHelper, 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
- #create_path ⇒ Object
- #destroy_link_options ⇒ Object
- #destroy_path ⇒ Object
- #edit_path ⇒ Object
- #index_path ⇒ Object
-
#initialize(source, options = {}) ⇒ Base
constructor
A new instance of Base.
- #model ⇒ Object
- #new_path ⇒ Object
-
#protect_against_forgery? ⇒ Boolean
TODO: FIX THIS!!!.
- #show_path ⇒ Object
- #update_path ⇒ 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 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/active_presenter_base.rb', line 36 def initialize(source, = {}) # running_time("source = #{source.class.to_s.underscore}; #{source}") do self.model_underscore = source.class.to_s.underscore self.model_camelcase = source.class.to_s eval %{alias :#{self.model_underscore} :model} @model = source self. = || {} # running_time("if source.is_a? ActiveRecord::Base") do # if source.is_a? ActiveRecord::Base # if source.is_restful? # running_time("if source.is_restful?") do # running_time("build_common_ar_resource_methods") do # build_common_ar_resource_methods # end # running_time("build_ar_resource_methods") do # build_ar_resource_methods # end # end # else # #build_ar_non_resource_methods # end # end # 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
#create_path ⇒ Object
116 117 118 119 120 |
# File 'lib/active_presenter_base.rb', line 116 def create_path ivar_cache do eval(path_builder(:type => :plural)) end end |
#destroy_link_options ⇒ Object
94 95 96 |
# File 'lib/active_presenter_base.rb', line 94 def {:confirm => 'Are you sure?', :method => :delete} end |
#destroy_path ⇒ Object
134 135 136 137 138 |
# File 'lib/active_presenter_base.rb', line 134 def destroy_path ivar_cache do eval(path_builder(:include_self => true)) end end |
#edit_path ⇒ Object
122 123 124 125 126 |
# File 'lib/active_presenter_base.rb', line 122 def edit_path ivar_cache do eval(path_builder(:prefix => "edit", :include_self => true)) end end |
#index_path ⇒ Object
98 99 100 101 102 |
# File 'lib/active_presenter_base.rb', line 98 def index_path ivar_cache do eval(path_builder(:type => :plural)) end end |
#model ⇒ Object
62 63 64 |
# File 'lib/active_presenter_base.rb', line 62 def model @model end |
#new_path ⇒ Object
110 111 112 113 114 |
# File 'lib/active_presenter_base.rb', line 110 def new_path ivar_cache do eval(path_builder(:prefix => "new")) end end |
#protect_against_forgery? ⇒ Boolean
TODO: FIX THIS!!!
90 91 92 |
# File 'lib/active_presenter_base.rb', line 90 def protect_against_forgery? false end |
#show_path ⇒ Object
104 105 106 107 108 |
# File 'lib/active_presenter_base.rb', line 104 def show_path ivar_cache do eval(path_builder(:include_self => true)) end end |
#update_path ⇒ Object
128 129 130 131 132 |
# File 'lib/active_presenter_base.rb', line 128 def update_path ivar_cache do eval(path_builder(:include_self => true)) end end |