clearance

'current_user' undefined in rails_admin with clearance

╄→гoц情女王★ 提交于 2021-02-07 14:23:13
问题 I've been using rails_admin v0.7.0 with the clearance gem successfully up this point. I tried to update rails_admin to v1.0 today, but am getting an undefined variable or method error for current_user . In v0.7.0 it appears that RailsAdmin::MainController inherits from ApplicationController , whereas in v1.0 it inherits directly from ActionController::Base , which would explain current_user is now undefined (I believe current_user is defined in ApplicationController with the clearance gem).

'current_user' undefined in rails_admin with clearance

泪湿孤枕 提交于 2021-02-07 14:22:17
问题 I've been using rails_admin v0.7.0 with the clearance gem successfully up this point. I tried to update rails_admin to v1.0 today, but am getting an undefined variable or method error for current_user . In v0.7.0 it appears that RailsAdmin::MainController inherits from ApplicationController , whereas in v1.0 it inherits directly from ActionController::Base , which would explain current_user is now undefined (I believe current_user is defined in ApplicationController with the clearance gem).

How to create an account when and assign it to a User when signing up via Clearance in rails

感情迁移 提交于 2020-01-06 08:43:11
问题 What is the best way with Clearance to automatically create a an "Account" with a unique account_id (doesn't have to be UUID) and assign it to the new user on sign up? I need to extend the clearance User sign up form and User controller to handle this but I'm having trouble getting this to work. Should this be a before_filter on signup or part of the User create action? Update: Adding some code for reference... # app/controllers/users_controller.rb class UsersController < Clearance:

Rails 4 with Clearance password reset issue

时光毁灭记忆、已成空白 提交于 2019-12-24 13:24:54
问题 I'm building an Rails 4 app with the authentication gem 'clearance'. I'm kind of stuck with the following problem: When an user forgets his/her password and would like to set a new password, the user is not found. (but exist in DB), this is the server log: Started PUT "/passwords/1?token=[FILTERED]" for 127.0.0.1 at 2013-08-10 21:00:58 +0200 Processing by PasswordsController#update as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "password_reset"=>"[FILTERED]", "token"=>"

Facebook auth for a Rails app using Clearance?

 ̄綄美尐妖づ 提交于 2019-12-06 05:04:42
问题 I'm writing a Rails 3.1 app, using Clearance for auth. I want to add standard Facebook auth: allow users to continue to register/authenticate with us directly (using Clearance) or via FB; if they sign in/register via FB and we already have an account for the associated email address, merge the accounts. There's good documentation out there for using OmniAuth/Devise, but i haven't found anything similar for Clearance. Are there (actively maintained) gems out there to help here, or even just

Removing or overriding an ActiveRecord validation added by a superclass or mixin

非 Y 不嫁゛ 提交于 2019-11-30 16:29:02
问题 I'm using Clearance for authentication in my Rails application. The Clearance::User mixin adds a couple of validations to my User model, but there's one of these that I would like to remove or override. What is the best way of doing this? The validation in question is validates_uniqueness_of :email, :case_sensitive => false which in itself isn't bad, but I would need to add :scope => :account_id . The problem is that if I add this to my User model validates_uniqueness_of :email, :scope =>