Passing objects?


I was wondering if it was possible to pass objects between methods in
the controllers - or whether you can only pass strings??


def method_one
@object = Model.find(params[:id)
redirect_to :action => “method_to”, :object => @object

def method_two
@object = params[:object]

The question is basically - can i access the object in method_two?
Or do i have to just pass the model id to method two and do another
query to find the model object?

Which is best practice?

Which is best practice?
Pass the model id and find it in the next action.

You could store the object in session (session[:object] = @object),
but generally it’s best to keep the session lightweight.