Sometimes you need to run an objects private method from the console or something.
For example your model may look something like this:
class Post < ActiveRecord::Base
#...
private
def set_initial_values
# do work
end
def update_title(new_url = false)
# do work
end
end
Fortunately it can be done using the send
method
@post.send(:set_initial_values)
# or with arguments
@post.send(:update_title, true)
Related External Links: