ruby on rails - NoMethodError (undefined method `authenticate_admin_user!' for #<Admin::DashboardController -
we using ruby 2.1 rails 3.2 , active admin 0.6.3. our site , running on front end when trying access admin panel, says:
"nomethoderror (undefined method `authenticate_admin_user!' admin::dashboardcontroller"
i've tried searching on net solutions none of them worked out.!
any suggestions?
edit : admin user model
activeadmin.register adminuser #menu :priority => 2 menu false index :title => 'admin users'+sitesetting.site_title column :email column :role |show| if show.role=="superadmin" status_tag('super admin', :ok) elsif show.role=="subadmin" status_tag('sub admin', :ok) elsif show.role=="customeadmin" status_tag('custom admin', :ok) else status_tag('normal admin', :ok) end end column 'current login', :current_sign_in_at column 'last login', :last_sign_in_at column 'login count', :sign_in_count #current_admin_user[:id] @count = adminuser.count if @count == 1 column |show| links = link_to 'view', {:action => show.id.to_s} links += ' ' links += link_to 'edit', {:action => show.id.to_s+'/edit'} links end else default_actions end end controller def password render :text => 'test' end def new @admin_user = adminuser.new end def create @temp = params[:admin_user][:role_permission] if @temp ==nil else @new_per = @temp.join(',') params[:admin_user][:role_permission] = @new_per end @admin_user = adminuser.new(params[:admin_user]) @admin_user.save redirect_to(:action => 'index') end def edit @admin_user = adminuser.find(params[:id]) end end filter :email sidebar :adminuserrights ul li "super admin: can manage pages" li "sub admin: can view , update pages" li "normal admin: can view pages" li "custom admin: customize admin via giving them custom rights of links" end end form :html => { :enctype => "multipart/form-data" } |f| render "create" , :layout => 'active_admin' end end
i 've code added in application controller file.
edit : application controller
def authenticate_active_admin_user! authenticate_admin_user! unless current_admin_user.role?(:superadmin) flash[:alert] = "you not authorized access resource!" redirect_to root_path end end
Comments
Post a Comment