Module: Exposure::Patterns::Resources
- Defined in:
- lib/exposure/patterns/resources.rb
Defined Under Namespace
Modules: Actions
Constant Summary collapse
- DefaultActions =
[:index, :show, :new, :create, :edit, :update, :destroy]
- Callbacks =
%w( before_find after_find after_find_on_failure after_find_on_success before_find_many after_find_many after_find_many_on_failure after_find_many_on_success before_assign after_assign before_save after_save after_save_on_failure after_save_on_success before_create after_create_on_failure after_create_on_success before_update after_update_on_failure after_update_on_success before_destroy after_destroy_on_success before_response before_response_on_success before_response_on_failure )
- DefaultFlashMessages =
{ 'create.success.html' => proc { "#{resource_name.capitalize} successfully created" }, 'update.success.html' => proc { "#{resource_name.capitalize} successfully updated" }, 'destroy.success.html' => proc { "#{resource_name.capitalize} successfully removed" } }
- DefaultResponses =
{ 'index.success.html' => proc { render('index') }, 'show.success.html' => proc { render('show') }, 'new.success.html' => proc { render('new') }, 'create.success.html' => proc { redirect_to({:action => 'index'}) }, 'edit.success.html' => proc { render('edit') }, 'update.success.html' => proc { redirect_to({:action => 'show' }) }, 'destroy.success.html'=> proc { redirect_to({:action => 'index'}) }, 'create.failure.html' => proc { render('new') }, 'update.failure.html' => proc { render('edit') }, 'index.success.xml' => proc { render(:xml => @resources) }, 'show.success.xml' => proc { render(:xml => @resource) }, 'new.success.xml' => proc { render(:xml => @resource) }, 'create.success.xml' => proc { render({:xml => @resource, :status => :created, :location => @resource}) }, 'created.failure.xml'=> proc { render(:xml => @resource.errors, :status => :unprocessable_entity)}, 'update.success.xml' => proc { head(:ok)}, 'update.failure.xml' => proc { render(:xml => @resource.errors, :status => :unprocessable_entity)}, 'destroy.success.xml'=> proc { head(:ok)}, 'index.success.json' => proc { render(:json => @resources) }, 'show.success.json' => proc { render(:json => @resource) }, 'new.success.json' => proc { render(:json => @resource) }, 'create.success.json' => proc { render({:json => @resource, :status => :created, :location => @resource}) }, 'created.failure.json'=> proc { render(:json => @resource.errors, :status => :unprocessable_entity)}, 'update.success.json' => proc { render(:json => @resource)}, 'update.failure.json' => proc { render(:json => @resource.errors, :status => :unprocessable_entity)}, 'destroy.success.json'=> proc { render(:json => @resource)} }
Class Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/exposure/patterns/resources.rb', line 4 def self.extended(base) base::const_set(:DefaultResponses, DefaultResponses) base::const_set(:DefaultFlashMessages, DefaultFlashMessages) base::const_set(:Finders, { true => {}, false => {} }) base::const_set(:Builders, {}) base::const_set(:FlashMessages, {}) base::const_set(:Responses, {} ) end |