I have a problem with flash/session in a facebooker application
running Rails 2.3.5. When I first started my little facebooker project
I had a problem with setting flashes: When I did set the for example
flash[:notice] = "Post saved" and then redirected the user to posts'
index page the flash didn't show.
After some time I figured out that I could fix this by changing the
session store from cookie to Active Record session store. This worked
perfect; I got my flashes out and when I took a look in the sessions
table in my database I got one row per user.
But now all of a sudden one user gets a new session per request; the
sessions table grows +1 per request even though I am the only one
accessing my development canvas application. I can't really say that I
have done anything different from before when it worked and I have
also checked out old versions of my code back to when I know that it
worked fine! I have also tried older versions of facebooker (I'm
currently on 1.0.61, but have also tried 1.0.58 which is the one I
used when it worked).
Have anyone experienced this too, or have any solutions I can try to
fix this?
I have the same problem with displaying a flash messages after
redirect with RoR 2.3.5 and latest version of the Facebooker plugin...
Martio
Mike
> --
> You received this message because you are subscribed to the Google Groups "facebooker" group.
> To post to this group, send email to faceb...@googlegroups.com.
> To unsubscribe from this group, send email to facebooker+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/facebooker?hl=en.
>
--
Mike Mangino
http://www.elevatedrails.com
As it stands now rack_setup.rb has this:
ActionController::Dispatcher.middleware.insert_before(
ActionController::Base.session_store,
Rack::FacebookSession,
ActionController::Base.session_options[:key]
)
Which means FACEBOOK_SESSION_KEY is changed to
ActionController::Base.session_options[:key]. Many (most?) set their
session key in an initializer which happens AFTER the plugin/gem is
loaded. You can see if you are suffering from this by running rake
middleware which might look something like this:
http://skitch.com/waloeiii/n1k56/andrew-loe-projects-onehub-caffe-bash
In my initial implementation, I used a closure to delay evaluation
until the first request, but that caused other problems in Mike's
testing so I reverted it to just eval the session key at load.
I'm not sure what the right solution is here, but what I'm doing by
default probably isn't obvious enough and should be changed. As a
quick fix you can just modify (or monkey-patch) your plugin to put a
string '_your_application_key', and it should do the right thing.
Beware if you are storing your sessions in memcache it doesn't like
the Facebook keys so you always sha1 the key (memcache-client has this
as a built in option).
> <mmang...@elevatedrails.com> wrote:
> > Was this working on previous versions? There was a change added for session handline in the rack extensions. Can you try removing that from the rack_setup.rb file (it's the second setup part) to see if that fixes it?
>
> > Mike
>
> > On Jan 26, 2010, at 8:32 AM, martio wrote:
>
> >> On 24 Sty, 12:56, Thorbjørn <thherman...@gmail.com> wrote:
> >>> I have a problem with flash/session in a facebooker application
> >>> running Rails 2.3.5. When I first started my little facebooker project
> >>> I had a problem with setting flashes: When I did set the for example
> >>> flash[:notice] = "Post saved" and then redirected the user to posts'
> >>> index page the flash didn't show.
>
> >> I have the same problem with displaying a flash messages after
> >> redirect with RoR 2.3.5 and latest version of the Facebooker plugin...
>
> >> Martio
>
> >> --
> >> You received this message because you are subscribed to the Google Groups "facebooker" group.
> >> To post to this group, send email to faceb...@googlegroups.com.
> >> To unsubscribe from this group, send email to facebooker+...@googlegroups.com.
> >> For more options, visit this group athttp://groups.google.com/group/facebooker?hl=en.
This patch does not work... I'm using rails 2.3.5 and default session
store...
Martin
On Jan 27, 6:08 am, "W. Andrew Loe III" <and...@andrewloe.com> wrote:
> I'm not sure what the right solution is here, but what I'm doing by
> default probably isn't obvious enough and should be changed. As a
> quick fix you can just modify (or monkey-patch) your plugin to put a
> string '_your_application_key', and it should do the right thing.
> Beware if you are storing your sessions in memcache it doesn't like
> the Facebook keys so you always sha1 the key (memcache-client has this
> as a built in option).
Can you please show us how you are doing this?
Thanks.
That worked for me.
On Mar 7, 11:02 am, zziemke <zzie...@googlemail.com> wrote:
> What is the correct way to make this work?
>
> On 7 Feb., 05:46, J. Pablo Fernández <pup...@pupeno.com> wrote:
>
> > On Jan 27, 6:08 am, "W. Andrew Loe III" <and...@andrewloe.com> wrote:
>
> > > I'm not sure what the right solution is here, but what I'm doing by
> > > default probably isn't obvious enough and should be changed. As a
> > > quick fix you can just modify (or monkey-patch) your plugin to put a
> > > string '_your_application_key', and it should do the right thing.
> > > Beware if you are storing yoursessionsin memcache it doesn't like