lib/ruhl/rails/ruhl_presenter.rb in ruhl-1.0.0 vs lib/ruhl/rails/ruhl_presenter.rb in ruhl-1.1.0

- old
+ new

@@ -44,14 +44,19 @@ module ActionController class Base protected - def present(action_sym = action_name, object = nil) - object_sym = object || controller_name.singularize + def present(options = {}) + action_sym = options[:action] || action_name + object_sym = options[:object] || controller_name.singularize - render :template => "#{controller_name}/#{action_sym}", - :locals => {:object => presenter_for(object_sym) } + params = { :template => "#{controller_name}/#{action_sym}", + :locals => {:object => presenter_for(object_sym) } } + + params[:layout] = options[:layout] if options.has_key?(:layout) + + render params end def presenter_for(object) if object.is_a?(Symbol) || object.is_a?(String)