OnRails Ruby wrote:
> Hi, everybody!
> I got a strange question when I did a controller test as below
> On controller.rb:
> 
> def send_welcome_message(person)
>   some codes;
> end
> there 'person' is instance variables.

Can I just check how you're using this method.
Is it a controller "action", as in, do you access it directly from a 
url?
eg. /controller/send_welcome_message/1

Or is it just a convenience method?

If it is an action, then an action can only be called without an 
argument
(it takes input from the http params, and inherits any instance 
variables defined in before_filters)

you say "person" is an instance variable.
so it should look like this

def send_welcome_message
  do the code involving @person
end

before_filter :get_person
def get_person
  @person = Person.find(params[:id])
end

hopefully that'll fix your problem.
-- 
Posted via http://www.ruby-forum.com/.