Module: Templates::ControllerExtensions
- Defined in:
- lib/templates/controller_extensions.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
2 3 4 5 6 |
# File 'lib/templates/controller_extensions.rb', line 2 def self.included(base) base.class_eval { before_filter :load_template, :only => [:new, :edit] } end |
Instance Method Details
#load_template ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/templates/controller_extensions.rb', line 8 def load_template unless params[:template].blank? case params[:template].to_i when 0 @page.template = @content_template = nil params[:page][:template_id] = nil if params[:page] else @page.template = @content_template = Template.find(params[:template]) params[:page][:template_id] = @content_template.id if params[:page] end end end |