Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imagine i have
- class Articles < Application
- # params will have :article key here!
- def create(attributes)
- ...
- end
- end
- # merb-action-args code
- def _call_action(action)
- arguments, defaults = self.class.action_argument_list[action]
- args = arguments.map do |arg, default|
- arg = arg
- # HERE the parameter name must be *right* so that everything works !?!
- # arg will be attributes here, but params doesn't contain it, it contains :article
- p = params.key?(arg.to_sym)
- raise BadRequest unless p || (defaults && defaults.include?(arg))
- p ? params[arg.to_sym] : default
- end
- __send__(action, *args)
- end
Add Comment
Please, Sign In to add comment