views:

439

answers:

1

mkristgan's rack_datamapper gem says that it "can be wrapped to be used in a specific environement, i.e. Rack::Session::Datamapper".

Unfortunately, I don't know quite enough about Ruby to accomplish this task yet –Modules/Classes in Ruby are still above my head (coming from PHP).

Can anyone offer assistance with using rack_datamapper to implement Rack::Session::Datamapper?

You probably don't want to do this anyway.

The answer below is great, but upon closer consideration, I realized I shouldn't do it anyway. Instead, I'm placing the user_id, ip and first name (for convenience) in a cookie and protecting it.

+3  A: 

http://github.com/pirj/rack-datamapper-session should help

In Sinatra just add: use Rack::Session::DataMapper

and use session[] object at will

don't forget to create sessions table: Rack::Session::DataMapperSession.auto_upgrade!

phil pirozhkov
Thanks, but I realized I should just put in the user_id and first name inside a signed cookie.
arbales
yeah, that's good until someone is trying to instruments someone else's user_id and taake other the session. beware!
phil pirozhkov