You should just be able to do that by making the controller a subclass of ApplicationController
explained here:
http://stackoverflow.com/questions/19147729/access-devise-current-user-variable-in-rails-controller
On Oct 6, 2014, at 9:14 PM, Joseph Wilks <lists@ruby-forum.com> wrote:
> So I'm creating a tv trivia game app, and when a user completes their
> quiz, I need to update certain aspects of the user (level/xp, also
> saving some of their answers to the database).
>
> However, I'm using devise for authentication, and I'm not sure how to
> access and update the current user when I'm in the quiz controller or
> quiz view. I'm assuming I need to add a helper method which gives the
> controller access to the current user, but I'm not sure how to do it
> exactly.
>
> Thanks in advance for your help.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/409dc897c54b41e8c9f8e0f4610f909d%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.
>
----
Jason Fleetwood-Boldt
tech@datatravels.com
http://www.jasonfleetwoodboldt.com/writing
All material © Jason Fleetwood-Boldt 2014. Public conversations may be turned into blog posts (original poster information will be made anonymous). Email jason@datatravels.com with questions/concerns about this.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/28ECAD36-311A-4512-9B62-BCE0A14DF099%40datatravels.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment