hello all,

I am reading rails3 from ruby.tutorails.org.

In chapter sign in sign out

i am facing one problem

c:/sites/pro/sample_app/app/helpers/sessions_helper.rb:27: syntax
error, unexpected tSTAR
User.authenticate_with_salt (*remember_token)
^
c:/sites/pro/sample_app/app/helpers/sessions_helper.rb:36: syntax
error, unexpected $end, expecting keyword_end



My SessionHelper code is as follows

Session_helper.rb

module SessionsHelper

def sign_in(user)
cookies.permanent.signed[ :remember_token] = [user.id, user.salt]
self.current_user = user
end

def current_user=(user)
@current_user = user
end
def current_user
@current_user ||= user_from_remember_token
end

def signed_in?
!current_user.nil?
end
def sign_out
cookies.delete (:remember_token)
self.current_user = nil
end

private

def user_from_remember_token
User.authenticate_with_salt (*remember_token)
end

def remember_token
cookies.signed[:remember_token] || [nil,nil]
end


end

I am not getting answer after doing so much google, and due to this
problem i am not able to read more .

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Frederick Cheung at Oct 7, 2011 at 9:12 am

    On Oct 2, 6:54 pm, rails_learner wrote:
    def sign_out
    cookies.delete (:remember_token)
    self.current_user = nil
    end

    private

    def user_from_remember_token
    User.authenticate_with_salt (*remember_token)
    end
    You shouldn't use spaces between a method name and its (

    Fred

    --
    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 rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Dave Aronson at Oct 10, 2011 at 10:12 pm

    On Fri, Oct 7, 2011 at 05:11, Frederick Cheung wrote:

    You shouldn't use spaces between a method name and its (
    I've heard that exclaimed as though Really Bad Things will happen if
    that is done. What's the deal? I've used spaces (as was long my
    standard coding style) and seen no ill effects, other than a warning
    not to do that.

    -Dave

    --
    LOOKING FOR WORK, preferably Ruby on Rails, in NoVa/DC; see main web site.
    Main Web Site: davearonson.com
    Programming Blog: codosaur.us
    Excellence Blog: dare2xl.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 rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedOct 5, '11 at 9:25p
activeOct 10, '11 at 10:12p
posts3
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase