Corey - could you go into a little more detail on the proxy object? I'm looking to do something along the lines of letting users (admins) make new forms for the public to submit data to. Following this screen cast I've got it implemented but I'm a Ruby and RoR n00bie.
I've the situation where what data I need to collect is custom per situation, so hard coding Models isn't an option so I am using the Admin's building of a collection of form fields and then dynamically building a model that is then used to make the form for the public and store the data in Mongodb. I've read a bit on factory design patterns and template patterns but I've not yet tried to apply this within rails to even see if it would work.
Folks have asked about combining Devise and other service providers, and there are great turorials (if somewhat dated and/or buggy) out there: github.com/RailsAps
I only posted relivant parts in users.rb which required a deviation from Ryan's
ruby
defself.new_with_session(params, session)
method so things would work with mongoid.
The other area of change is in the authentication_controller.rb
ruby
defall
went through some changes so that we could allow username/password registrations and logins, registrations and logins via facebook and to allow account linkage of existing accounts with 3rd party providers.
Also had to add a method:
ruby
defcreate_new_omniauth_user(auth)
in the controller, again to appease the mongoid gods since the Authentication can't be saved before the user record.
I went about making a authentications "table" to store the different 3rd party credentials in so users could use multiple providers to login or sign up with, however the only one I've implemented is facebook, so there may be changes you'd need to do in the user.new_with_session method to work with the omniauth.auth hash data.
@pkohli1 - That's actually how it's supposed to work. Logging out on your app logs out the user from your system but that user should not be logged out of Facebook.
Corey - could you go into a little more detail on the proxy object? I'm looking to do something along the lines of letting users (admins) make new forms for the public to submit data to. Following this screen cast I've got it implemented but I'm a Ruby and RoR n00bie.
I've the situation where what data I need to collect is custom per situation, so hard coding Models isn't an option so I am using the Admin's building of a collection of form fields and then dynamically building a model that is then used to make the form for the public and store the data in Mongodb. I've read a bit on factory design patterns and template patterns but I've not yet tried to apply this within rails to even see if it would work.
Folks have asked about combining Devise and other service providers, and there are great turorials (if somewhat dated and/or buggy) out there: github.com/RailsAps
I used the example on rails3-mongoid-omniauth and combind with the railscasts to get Devise, omniauth-facebook and mongoid up and running for myself. Here's a pastebin devise, omniauth-facebood and mondoig
I only posted relivant parts in users.rb which required a deviation from Ryan's
method so things would work with mongoid.
The other area of change is in the authentication_controller.rb
went through some changes so that we could allow username/password registrations and logins, registrations and logins via facebook and to allow account linkage of existing accounts with 3rd party providers.
Also had to add a method:
in the controller, again to appease the mongoid gods since the Authentication can't be saved before the user record.
I went about making a authentications "table" to store the different 3rd party credentials in so users could use multiple providers to login or sign up with, however the only one I've implemented is facebook, so there may be changes you'd need to do in the user.new_with_session method to work with the omniauth.auth hash data.
@pkohli1 - That's actually how it's supposed to work. Logging out on your app logs out the user from your system but that user should not be logged out of Facebook.