rails/rails — pull request #12212 by gregorym (2013-09-13 03:53:06+00:00)
Title: Extend serializable_hash methods in order to pass parameters to methods

Hi,

Many times I need to call methods with parameters using `as_json` but cannot because the API is not expecting this behavior.

Here is the API I am suggesting:
````Ruby
class User
attr_accessor :name

def initialize(age)
@age = age
end

def make_me_older(years)
@age + years
end
end

User.new(10).serializable_hash(methods: [:age, [:make_me_older, 10]]
=> {"make_me_older"=> 18}
````

This idea is to pass an array where the first element is the method name and all the other elements are parameters to the method.

Greg