devise

Second devise model not using generated views

只谈情不闲聊 提交于 2020-01-31 18:12:19
问题 I have a User and a Rep model devise_for :users, :controllers => {:registrations => 'user_registration'} devise_for :reps I ran rails generate devise:views reps The custom views show up in app/views/reps But the rep paths are still using the built in devise views Rendered ~/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.4.9/app/views/devise/registrations/edit.html.erb Instead of the generated reps views. 回答1: By simply putting the views there Devise won't use them. You would need to point Devise:

Skip before filter with Active Admin

风格不统一 提交于 2020-01-29 10:38:04
问题 I am using devise and recently added active admin, which created a separate table of admin_users to keep admins. All works fine with Active Admin when I try to log in and browse around. However, my application controller has this for general users: before_filter :authenticate_user!, :except => [:show, :index] Because of this, when inside the active admin interface, whenever I try to edit or delete anything, it asks me to log in. I learned that a skip_before_filter can be used inside the

Send multiple invitation using devise-invitable gem in rails

て烟熏妆下的殇ゞ 提交于 2020-01-25 20:36:05
问题 I want to send multiple invitations at a time using devise-invitable gem. new.html.erb <h2> <%= t "devise.invitations.new.header" %> </h2> <%= form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => {:method => :post} do |f| %> <%= devise_error_messages! %> <div> <% resource.class.invite_key_fields.each do |field| -%> <p><%= f.label field %><br /> <%= f.email_field field, placeholder: "Invitation email" %></p> <% end -%> <%= f.collection_select(:role_id, Role

Rails partial validations depending on conrtoller

北城余情 提交于 2020-01-25 06:42:18
问题 I am using devise for user registrations, meaning, that by default new user is registered through registrations_controller. So by clicking button "Register" user is redirected to a new_user_registration path. My registration form however has two steps. In first step (new_user_registration) I am asking for a name and password. In the second step (users_controller), when user is saved, I am asking for address. This I am doing with wizard gem: def create @user = User.new(params[:user]) if @user

Rails partial validations depending on conrtoller

喜你入骨 提交于 2020-01-25 06:42:14
问题 I am using devise for user registrations, meaning, that by default new user is registered through registrations_controller. So by clicking button "Register" user is redirected to a new_user_registration path. My registration form however has two steps. In first step (new_user_registration) I am asking for a name and password. In the second step (users_controller), when user is saved, I am asking for address. This I am doing with wizard gem: def create @user = User.new(params[:user]) if @user

Implementing Security questions

偶尔善良 提交于 2020-01-25 02:29:29
问题 I am using devise for the signin process. Now my requirement is: *User will enter some answers to the questions during registration. When the user signin with his email and password, he will be asked with those security questions. If the answers are correct, he will be directed to dashboard or else if he fails to answer (2 out of 3), then the account will be locked.* Is there any easy method to implement this MFA in Rails? Thanks in advance.. 回答1: I would recommend using Devise with the

Devise polymorphic association nested attributes with simple form using rails 4

左心房为你撑大大i 提交于 2020-01-24 20:20:27
问题 I am making a polymorphic association with devise and simple for but for some reason i cant get the params to work here is my code: User: class User < ActiveRecord::Base devise :database_authenticatable, :rememberable, :trackable, :validatable belongs_to :loginable, polymorphic: true end Designer: class Designer < ActiveRecord::Base has_one :user, as: :loginable accepts_nested_attributes_for :user end Layout: <%= simple_form_for [:admin, @designer] , :html => { :class => 'form-horizontal' }

Strong parameters - Devise 3.0.0 and Rails 4. “Unpermitted parameters: name”

谁说胖子不能爱 提交于 2020-01-24 20:01:06
问题 I am currently using Rails 4 and Devise 3.0.0. I have tried to add a custom field of "Name" to the sign up form and edit registration form. Whenever I submit the form, the following errors arise: Unpermitted parameters: name WARNING: Can't mass-assign protected attributes for User: email, password, password_confirmation. I understand that this has something to do with the way Rails 4 handles parameters, but I do not understand what I am supposed to do about it right now. I have searched

Devise auth/sign_in api not returning access-token and client

a 夏天 提交于 2020-01-24 16:16:23
问题 i have recently integrated omniauth plugin into my rails app. and now i have stuck with some issue in devise sign_in api. The api is not returning the access-token and client information. Request payload {""email":"testuser@gmail.com","password":"test123"} Request headers POST /auth/sign_in HTTP/1.1 Host: localhost:3000 Connection: keep-alive Content-Length: 95 Cache-Control: max-age=0 Accept: application/json, text/plain, */* Origin: http://localhost:3000 If-Modified-Since: 0 User-Agent:

Devise auth/sign_in api not returning access-token and client

血红的双手。 提交于 2020-01-24 16:15:40
问题 i have recently integrated omniauth plugin into my rails app. and now i have stuck with some issue in devise sign_in api. The api is not returning the access-token and client information. Request payload {""email":"testuser@gmail.com","password":"test123"} Request headers POST /auth/sign_in HTTP/1.1 Host: localhost:3000 Connection: keep-alive Content-Length: 95 Cache-Control: max-age=0 Accept: application/json, text/plain, */* Origin: http://localhost:3000 If-Modified-Since: 0 User-Agent: