Module: Optimacms::Mycontroller
- Defined in:
- lib/optimacms/mycontroller.rb
Instance Method Summary collapse
- #default_render(*args) ⇒ Object
- #my_set_meta(meta) ⇒ Object
-
#my_set_render ⇒ Object
included do before_filter :my_set_render end.
- #my_set_render_template(tpl_view, tpl_layout) ⇒ Object
Instance Method Details
#default_render(*args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/optimacms/mycontroller.rb', line 14 def default_render(*args) if self.controller_name!='pages' && !@optimacms_tpl.nil? && @is_optimacms render @optimacms_tpl, :layout=>@optimacms_layout and return #(render :text => "hello", :layout => @optimacms_layout) and return # http://stackoverflow.com/questions/21129587/ruby-on-rails-how-to-render-file-as-plain-text-without-any-html #render :plain will set the content type to text/plain #render :html will set the content type to text/html #render :body will not set the content type header. # render text: "some text". :plain does not work. end super end |
#my_set_meta(meta) ⇒ Object
34 35 36 37 38 |
# File 'lib/optimacms/mycontroller.rb', line 34 def () = [:title] = [:keywords] = [:description] end |
#my_set_render ⇒ Object
included do
before_filter :my_set_render
end
9 10 11 12 |
# File 'lib/optimacms/mycontroller.rb', line 9 def my_set_render @is_optimacms = true end |
#my_set_render_template(tpl_view, tpl_layout) ⇒ Object
29 30 31 32 |
# File 'lib/optimacms/mycontroller.rb', line 29 def my_set_render_template(tpl_view, tpl_layout) @optimacms_tpl = tpl_view @optimacms_layout = tpl_layout end |