collin (owner)

Revisions

gist: 121277 Download_button fork
public
Public Clone URL: git://gist.github.com/121277.git
Embed All Files: show embed
rails_action_args.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module AbstractController
  class Base
  private
    # Modification of abstract controllers process action to take and
    # pass on any arguments to "send_action" (currently alias for "send")
    def process_action(*args)
      send_action(*args)
    end
  end
end
 
module ActionController
  class ActionArgsController < Base # new_base
  private
    def process_action(action_name)
      super(action_name, *action_arguments_for(action_name))
    end
 
    def action_arguments_for(action_name)
      # implementation returning array which containes values from params hash
      # uses default values and raises error for bad requests
    end
  end
end