weotch
weotch

Reputation: 5878

How can I access cookies from a model in Rails 3

I am using the Koala gem to interact with the Facebook API. In order to connect to the API, I need to pass my cookies to Koala. I want to do this in a model because I want to add additional data to the user from Facebook data during a before_create callback in the model. For instance, if a user has an active FB session, store their Facebook UID when creating their user row. How do I get at cookies from within a model?

Upvotes: 3

Views: 2967

Answers (1)

Dave Newton
Dave Newton

Reputation: 160171

Models should not be aware they're operating in a web environment.

What you might want to consider instead is just storing the FB UID on the model the same way as any other property, by setting it on the model during creation.

Upvotes: 7

Related Questions