cancan Questions
2
Solved
I've been going through the railscast on using the cancan gem but am stuck on how to only allow a user to visit their own show page.
My code looks like this:
Ability model
class Ability
include...
Rooke asked 12/6, 2011 at 18:15
2
Solved
I'm developing a Rails 3 app using Devise and CanCan.
The app allows anonymous (not registered) users to access some of the app, and registered users to access other parts.
One aspect of the app (a...
Bainmarie asked 21/3, 2011 at 22:22
1
Solved
I need to check :read? on an object in the console, how can I do this?
Eckblad asked 16/5, 2011 at 14:15
1
Solved
What exactly is happening when I do:
@patient.course_enrollments.accessible_by(current_ability)
What seems to happen is I get course_enrollments where course.client_id = user.client.id, I just d...
Matsumoto asked 17/3, 2011 at 19:36
1
Solved
According to all documentation, the :read action is aliased to both :index and :show:
alias_action :index, show, :to => :read
However, consider the following scenario with nested resources:
...
Motoneuron asked 12/3, 2011 at 5:30
1
I'm changing some of my custom CanCan actions in the Ability class to use blocks instead of just a hash but now they've stopped actually restricting access. The odd thing is that the built in actio...
Gaddy asked 20/1, 2011 at 2:31
2
Solved
I am having difficulty getting a rspec test for a controller to pass. I would like to test that the POST create action works. I am using rails (3.0.3), cancan (1.4.1), devise (1.1.5), rspec (2.3.0)...
Deduce asked 3/1, 2011 at 9:0
1
Solved
I have Projects resource which is nested in Users resource.
My Cancan Ability class is:
class Ability
include CanCan::Ability
def initialize(user)
#everyone
can :read, Project
if user.blank...
Taylor asked 22/10, 2010 at 5:51
1
Solved
On my rails app I have implemented AuthLogic and CanCan. However when trying to figure out if the user can manage an article (checks if he is owner through the article.user_id) with CanCan I am run...
Monies asked 16/9, 2010 at 1:55
1
Solved
In the documentation of CanCan it shows how to fetch all accessible records in this way:
@articles = Article.accessible_by(current_ability)
but what is current_ability? I've tried passing the cu...
Losse asked 30/7, 2010 at 5:34
1
Solved
You can get the current_user's permissions from a view or controller using can? in this fashion:
<% if can? :update, @article %>
<%= link_to "Edit", edit_article_path(@article) %>
&...
Sherikasherill asked 20/7, 2010 at 19:6
© 2022 - 2024 — McMap. All rights reserved.