I am newbie to rail. Trying to develop social networking site so working
with railspace application. Everything is working fine but I stuck in
the problem when i am giving the authorization tocken to the user to
remember him/her.

My Error and controller code is below

Error:-
private method `gsub' called for 4:Fixnum

C:/Users/Amir/Downloads/IR/ruby/lib/ruby/1.8/cgi.rb:342:in `escape'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/cgi_ext/cookie.rb:73:in
`to_s'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/cgi_ext/cookie.rb:73:in
`collect'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/cgi_ext/cookie.rb:73:in
`to_s'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/cookies.rb:80:in
`set_cookie'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/cookies.rb:65:in
`[]='
app/controllers/user_controller.rb:27:in `login'

user_controller

if request.get?
@user = User.new(:remember_me => cookies[:remember_me] || "0")
elsif param_posted?(:user)
@user = User.new(params[:user])
user = User.find_by_screen_name_and_password(@user.screen_name,
@user.password)
if user
user.login!(session)
if @user.remember_me == "1"
cookies[:remember_me] = { :value => "1",
:expires => 10.years.from_now }
  user.authorization_token = user.id
user.save!
cookies[:authorization_token] = {
:value => user.authorization_token,
:expires => 10.years.from_now }
  else
cookies.delete(:remember_me)
cookies.delete(:authorization_token)
end
flash[:notice] = "User #{user.screen_name} logged in!"
redirect_to_forwarding_url
else
@user.clear_password!
flash[:notice] = "Invalid screen name/password combination"
end
end
end

Please do the needful. I don't have much time, I need to deliver this
project in my college.

Thanks
Amir

-- 
Posted via http://www.ruby-forum.com/.

-- 
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