declerative_authorization on User problem

Posted by Webpain on Stack Overflow See other posts from Stack Overflow or by Webpain
Published on 2010-04-10T22:33:09Z Indexed on 2010/04/10 22:43 UTC
Read the original article Hit count: 206

I am trying to block all default methods except create and update in my users controller using declerative_authorization. But at the time I add filter_resource_access or filter_access_to into my usersController i always get "Couldn't find User without an ID". Anyone care to explain why this could be happening?

    class UsersController  :new
    end
  end

  def show
    @user = @current_user
  end

  def edit
    @user = @current_user
  end

  def update
    @user = @current_user # makes our views "cleaner" and more consistent
    if @user.update_attributes(params[:user])
      flash[:notice] = "Account updated!"
      redirect_to account_url
    else
      render :action => :edit
    end
  end
end

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about authorization