Created
May 4, 2016 19:46
-
-
Save oseifrimpong/87e6160de65865dac782c2f9aef18b30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Sign up</h2> | |
<!--<% resource.profile || resource.build_profile %> --> | |
<% resource.build_profile %> | |
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> | |
<%= devise_error_messages! %> | |
<div class="field"> | |
<%= f.label :email %><br /> | |
<%= f.email_field :email, autofocus: true %> | |
</div> | |
<div class="field"> | |
<%= f.label :password %> | |
<% if @minimum_password_length %> | |
<em>(<%= @minimum_password_length %> characters minimum)</em> | |
<% end %><br /> | |
<%= f.password_field :password, autocomplete: "off" %> | |
</div> | |
<div class="field"> | |
<%= f.label :password_confirmation %><br /> | |
<%= f.password_field :password_confirmation, autocomplete: "off" %> | |
</div> | |
<!-- For User profile registration--> | |
<div class="field"> | |
<%= f.fields_for :profile do |profile_form| %> | |
<p><%= profile_form.label :first_name %></p> | |
<p><%= profile_form.text_field :first_name %></p> | |
</div> | |
<p><%= profile_form.label :last_name %></p> | |
<p><%= profile_form.text_field :last_name %></p> | |
<p><%= profile_form.label :username %></p> | |
<p><%= profile_form.text_field :username %></p> | |
<p><%= profile_form.label :email %></p> | |
<p><%= profile_form.text_field :email %></p> | |
<p><%= profile_form.label :phone %></p> | |
<p><%= profile_form.text_field :phone %></p> | |
<p><%= profile_form.label :delivery_address %></p> | |
<p><%= profile_form.text_area :delivery_address %></p> | |
<% end %> | |
<div class="actions"> | |
<%= f.submit "Sign up" %> | |
</div> | |
<% end %> | |
<%= render "users/shared/links" %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sign_up_params | |
devise_parameter_sanitizer.sanitize(:sign_up) | |
params.require(:user).permit(:email, :password, profile_attributes: [:first_name, :last_name, :username, :email, :phone, :delivery_address]) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
devise :database_authenticatable, :registerable, | |
:recoverable, :rememberable, :trackable, :validatable | |
has_one :profile | |
accepts_nested_attributes_for :profile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment