Devise/Rails – How to remove a particular flash message? (Signed in Successfully)
You just define it to an empty string in your local file. In this case you can see nothing.
You just define it to an empty string in your local file. In this case you can see nothing.
Under the assumption that you want to see these controllers in order to modify or override them, Devise now provides a simple generator which recreates their controllers in your app to make this easy. As per the documentation (which will be most up-to-date): 1) Create your custom controllers using the generator which requires a scope: … Read more
What brian said works perfectly http://net.tutsplus.com/tutorials/ruby/create-beautiful-administration-interfaces-with-active-admin/ AdminUser.create!(:email => ‘admin@example.com’, :password => ‘password’, :password_confirmation => ‘password’)
Alternatively, you can create your own sessions controller class SessionsController < Devise::SessionsController def new super end def create self.resource = warden.authenticate!(auth_options) set_flash_message(:notice, :signed_in) if is_navigational_format? sign_in(resource_name, resource) if !session[:return_to].blank? redirect_to session[:return_to] session[:return_to] = nil else respond_with resource, :location => after_sign_in_path_for(resource) end end end And in routes.rb add: devise_for :users, controllers: {sessions: “sessions”}
to “enable” confirmable, you just need to add it to your model, e.g.: class User # … devise :confirmable , …. # … end after that, you’ll have to create and run a migration which adds the required columns to your model: # rails g migration add_confirmable_to_devise class AddConfirmableToDevise < ActiveRecord::Migration def self.up add_column :users, … Read more
In Rails 5 you must include Devise::Test::IntegrationHelpers instead Devise::Test::ControllerHelpers: # rails_helper.rb config.include Devise::Test::IntegrationHelpers, type: :feature See more: https://github.com/plataformatec/devise/issues/3913#issuecomment https://github.com/plataformatec/devise/pull/4071
This is what finally worked. class Api::V1::SessionsController < Devise::SessionsController def create respond_to do |format| format.html { super } format.json { warden.authenticate!(:scope => resource_name, :recall => “#{controller_path}#new”) render :status => 200, :json => { :error => “Success” } } end end def destroy super end end Also change routes.rb, remember the order is important. devise_for :users, … Read more
You should generate a users_controller which inherits from application_controller and define there your custom show method. Don’t forget to create a view and routes for it. Ex: #users_controller.rb def show @user = User.find(params[:id]) end #in your view <%= @user.name %> #routes.rb match ‘users/:id’ => ‘users#show’, via: :get # or get ‘users/:id’ => ‘users#show’ # or … Read more
The correct way to fix this, REST-wise, would be to change your logout links to use the DELETE method. It’s a very easy fix, changing this: link_to “Log out”, destroy_user_session_path to this: link_to “Log out”, destroy_user_session_path, :method => :delete
I think you’ll need to manage the Devise views yourself. Try the following in a console: rails generate devise:views This will generate all the views Devise uses (including mailer templates), which you can now customize. The mailers you’re looking for should then be in ‘app/views/devise/mailer’ If you want to generate scoped views, or only a … Read more