On Mar 9, 11:40 pm, Ashwin Vel <[email protected]> wrote:
> I have a controller for registering an user.
> i am not able to use the instance variable @username in "Process". How
> do i use them ? and also is it safe to declare usernames and passwords
> as global variables.

While process and register are two instance methods of your
controller, if your user first goes to the register page and then to
the process page then those are two difference instances of
RegisterController. In a real world deployment they could be handled
by different instances of mongrel/unicorn/passenger/etc, possibly by
different servers. Global variables are also a bad idea. Your choices
for state are pretty much the database, cookies (or the session, but
that sits on top of either cookies or the database) or, to some extent
the html that you spit out

Fred
>
> I am pretty new to ruby on rails. any help would be great.
>
> class RegisterController < ApplicationController
>
>  def register
> �...@username = "User"
> �...@password =  "XXXX"
>
>  end
>
>  def process
>  # puts "#...@username}"    - Doesnt work
>
>  end
>
> end
>
> -Ashwin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to