无法使用devise rails 4 app注册新用户

时间:2014-06-23 18:50:47

标签: ruby-on-rails ruby ruby-on-rails-4 devise cancan

我在Rails& amp;设计。不知何故,我无法在本地注册新用户。我可以通过控制台注册用户。目前这一切都有效。 我的routes.rb看起来像这样:

devise_for :users,:path => '', :path_names => {:sign_in => 'eisodo', 
    :sign_out => 'exodo', :sign_up => 'register'}, 
    :controllers => { :registrations => "registrations" }

我在这里检查了类似的问题并遵循了一些建议:我已将resources :users添加到routes.rb文件以及devise_for:users, "path_prefix"但我仍然无法让它发挥作用。

我的ability.rb文件如下所示:

class Ability
  include CanCan::Ability

  def initialize(user)
    user ||= User.new # guest user (not logged in)
    if user.role == "admin"
      can :manage, :all
    elsif user.role == "manager"
      can [:read, :update, :create], [Job, Equipment]
      #can [:read, :update, :create], [Equipment]
    elsif user.role == "employee"
      can [:read, :update, :create], [Equipment, Job]
      cannot [:create], [Job]
      #can [:read, :update], [Equipment]
    end
  end
 end

有人解决了这个问题吗?

0 个答案:

没有答案