sessions based off ip?

0 views
Skip to first unread message

stuartc

unread,
Nov 26, 2009, 12:23:08 AM11/26/09
to CommunityEngine
Greetings everyone,

I've been implementing CE on a rather large project, and I have
mobilized the template for mobile browsers as well as dektops (i just
added a method in the AppController), the before_filter just sets a
session variable that dictates if the views must be rendered with the
mobile templates or the desktop ones.

Now there are 3 of us working on this app, all on the same network,
and our production server is offsite (so we all come through as the
same IP). If I use a Windows mobile device to access the app, first
time it works as expected.

But then say I come from a desktop, sometimes it just renders the
mobile template, or thinks I'm continuing a session.

Any advice how to get around this?

Carl Fyffe

unread,
Nov 26, 2009, 12:41:33 AM11/26/09
to communi...@googlegroups.com
Don't make store the information in the session, store it in a cookie.
Or make it based on the domain they are accessing the site through
m.yoursite.com uses the mobile layout, all others use the desktop
layout.

<over-generalized-statement>Sessions are bad.</over-generalized-statement>
> --
>
> You received this message because you are subscribed to the Google Groups "CommunityEngine" group.
> To post to this group, send email to communi...@googlegroups.com.
> To unsubscribe from this group, send email to communityengi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/communityengine?hl=en.
>
>
>

stuartc

unread,
Nov 26, 2009, 4:22:40 AM11/26/09
to CommunityEngine
Thank you for your response, it seems that the session variable was in
fact being changed depending on which device was accessing it.

It seems caches_action on the BaseController was causing all the
problems with the views being rendered.

I have conditions in my templates to render mobile browser views, the
caches_action overrode that evaulation, and just returned the cached
page. (I should have thought about how this only happened in
production mode)

So I removed caching for the pages it effected. Another way through
would be to have the controllers render different pages, as
caches_action doesn't override the Action Pack.

On Nov 26, 7:41 am, Carl Fyffe <carl.fy...@gmail.com> wrote:
> Don't make store the information in the session, store it in a cookie.
> Or make it based on the domain they are accessing the site through
> m.yoursite.com uses the mobile layout, all others use the desktop
> layout.
>
> <over-generalized-statement>Sessions are bad.</over-generalized-statement>
>
Reply all
Reply to author
Forward
0 new messages