Hi All,
Hope this note helps the newbies to Rails
As I'm new to Rails, I'd like to share how I tracked down Safari's
dropping of my cookie.

My Applebug no: 11003492 registered 7 March/2012

My development platform:
MacPro running rails 3.1.1 on OS X Lion 10.7.3 (11D50b)

Firefox worked as programmed but switching to Safari my
current_user_token kept in the cookie[:remember_user_token] became
nil. Later in the debug sessions, this value returned was due to the
cookie being removed by Safari --- not present!

The steps leading to Safari dropping of the cookie
1) signin and set the cookie[:remember_user_token] to User.id
2) get /index_stats for user --- cookie still valid
3) get /show_stats : rendering the view showed that the cookie value
returned was nil

How to debug the problem?:
1) Use the Ruby method set_trace_func to see the source code being
a) U must be judicious in turning on / off the set_trace_func
method as it blows out a lot of source tracing.
b) Use of Unix split utility helped at the beginning to pare down
the size of file to edit as u could blow up your editor due to size

2) from the above output it lead me to look at the Ruby source code:

3) By reading the ruby code and to modify it to output some of its
values to STDOUT this allowed me to refine the next debugging steps
to catch the problem . Note use of logger.debug in the above source
will not work as the logger method is not defined!

4) I refined my tracing output strategies and ran it against both
browsers: Firefox and Safari for a comparison analysis.

5) Running the Unix diff utility against the 2 browser outputs homed
in on Safari missteps --- niled cookie

6) By inspecting the cookie for both browsers, it showed that Safari
had removed the cookie[:remember_user_token]
I sent to Apple these 2 traced outputs as evidence of the Safari

I found set_trace_func a good starting point to see what is happening.
I experimented with ruby-debug but this was too fined-grained for my
current problem at hand.

Hope this helps to your programming efforts.

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
postedMar 8, '12 at 4:00p
activeMar 8, '12 at 4:00p

1 user in discussion

Dave: 1 post



site design / logo © 2022 Grokbase