ruby - Unable to sign_up using Devise and CanCan in Rails -
i been working on application in have number of roles , users.
however can't sign-up anymore. signing in works fine, signing redirects me signing page , produces same error:
the console shows following when try sign up:
started post "/registers/user/registration" 127.0.0.1 @ 2013-04-18 00:48:22 +0100 processing registerscontroller#registration html parameters: {"utf8"=>"✓", "authenticity_token"=>"ofucdxxzzfbtvlfvaa3qxixohl2v9hzxfsfu/99pd60=", "user"=>{"name"=>"omar arroum", "email"=>"omar@gmail.com", "password"=>"[filtered]", "password_confirmation"=>"[filtered]"}, "commit"=>"sign up", "id"=>"user"} completed 401 unauthorized in 1ms started "/users/sign_in" 127.0.0.1 @ 2013-04-18 00:48:22 +0100 processing devise::sessionscontroller#new html rendered devise/shared/_links.html.erb (0.4ms) rendered devise/sessions/new.html.erb within layouts/application (9.8ms) rendered layouts/_navigation.html.erb (1.3ms) rendered layouts/_messages.html.erb (0.1ms) completed 200 ok in 63ms (views: 61.6ms | activerecord: 0.0ms)
i haven't made changes `user_controller.rb, not sure causing issue
edit: added registerscontroller
class registerscontroller < applicationcontroller #before_filter :authenticate_user! load_and_authorize_resource # /registers # /registers.json def index @registers = register.all respond_to |format| format.html # index.html.erb format.json { render json: @registers } end end # /registers/1 # /registers/1.json def show @register = register.find(params[:id]) respond_to |format| format.html # show.html.erb format.json { render json: @register } end end # /registers/new # /registers/new.json def new @register = register.new(:event_id => params[:event_id]) respond_to |format| format.html # new.html.erb format.json { render json: @register } end end # /registers/1/edit def edit @register = register.find(params[:id]) end # post /registers # post /registers.json def create @register = register.new(params[:register]) respond_to |format| if @register.save format.html { redirect_to @register, notice: 'register created.' } format.json { render json: @register, status: :created, location: @register } else format.html { render action: "new" } format.json { render json: @register.errors, status: :unprocessable_entity } end end end # put /registers/1 # put /registers/1.json def update @register = register.find(params[:id]) studentregister.find_all_by_register_id(@register).each |streg| streg.update_attributes(:present => false, :late => false) #sets users status being absent, purpose of when copying new register, #as presence , lateness otherwise maintained end respond_to |format| if @register.update_attributes(params[:register]) format.html { redirect_to @register, notice: 'register updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @register.errors, status: :unprocessable_entity } end end end # delete /registers/1 # delete /registers/1.json def destroy @register = register.find(params[:id]) @register.students.delete_all_on_destroy @register.destroy respond_to |format| format.html { redirect_to registers_url } format.json { head :no_content } end end def registration @studentregister = studentregister.find_all_by_register_id(params[:id]) end def copy @register = register.find(params[:id]).amoeba_dup #creates duplicate of existing register students in @register.date = date.today #sets registers date today's date @register.save respond_to |format| format.html { redirect_to edit_register_path(@register) } #redirects edit page can make updates format.json { head :no_content } end end end
you doing before_filter :authenticate_user!
in registerscontroller (most likely). produces 401 response , flash message devise. cancan should have nothing it. post registerscontroller.
Comments
Post a Comment