Module Resourceful::Default::Callbacks
In: lib/resourceful/default/callbacks.rb

This module is mostly meant to be used by the make_resourceful default actions. It provides various methods that declare where callbacks set in the make_resourceful block, like Builder#before and Builder#response_for, should be called.

Methods

after   before   response_for   scope  

Public Instance methods

Calls any after callbacks set in the make_resourceful block for the given event.

[Source]

    # File lib/resourceful/default/callbacks.rb, line 16
16:       def after(event)
17:         resourceful_fire(:after, event.to_sym)
18:       end

Calls any before callbacks set in the make_resourceful block for the given event.

[Source]

    # File lib/resourceful/default/callbacks.rb, line 11
11:       def before(event)
12:         resourceful_fire(:before, event.to_sym)
13:       end

Calls any response_for callbacks set in the make_resourceful block for the given event. Note that these aren’t called directly, but instead passed along to Rails’ respond_to method.

[Source]

    # File lib/resourceful/default/callbacks.rb, line 23
23:       def response_for(event)
24:         if responses = self.class.read_inheritable_attribute(:resourceful_responses)[event.to_sym]
25:           respond_to do |format|
26:             responses.each do |key, value|
27:               format.send(key, &scope(value))
28:             end
29:           end
30:         end
31:       end

Returns a block identical to the given block, but in the context of the current controller. The returned block accepts no arguments, even if the given block accepted them.

[Source]

    # File lib/resourceful/default/callbacks.rb, line 37
37:       def scope(block)
38:         lambda do
39:           instance_eval(&(block || lambda {}))
40:         end
41:       end

[Validate]