Displaying 1 result from an estimated 1 matches for "create_with_omniauth".
2012 Jan 18
4
Adding a custom select to omniauth register form
...lect field that populates from a class
constant in my user model.
Here''s my model:
class User < ActiveRecord::Base
ROLES = ["Customer","Service Supplier"]
has_many :leads
validates_presence_of :role
def self.from_omniauth(auth)
...
end
def self.create_with_omniauth(auth)
...
end
end
Here''s a snippet of my view from identities/new.html.erb:
<%= form_tag "/auth/identity/register" do %>
…
<div class="field">
<%= label_tag :role %><br>
<%= select :user, :role, User::ROLES %>
</div>...