Cancan correctly disable the creation method in controller (raising 500 
error) but activescaffold not skip the create action link in the table 
header.
I think the solution is fix create_ignore? method:

def create_ignore?
  (!nested? && active_scaffold_config.list.always_show_create) || 
!create_authorized?end

The original create_ignore? method do not check unauthorized creation at 
class level (!create_authorized?), so AS unauthorize link but do not skip 
this or disable it.

https://github.com/activescaffold/active_scaffold/issues/178




Il giorno giovedì 6 settembre 2012 13:39:44 UTC+2, Mike Blyth ha scritto:
>
> I'm trying to get rid of the "Create new" link conditionally, when users 
> are not authorized to create. I'm using CanCan. The links within rows are 
> suppressed properly (or greyed out), but the top-of-page Create link is 
> still there. I have tried
>
>    - def authorized_for_create? # in model
>      false
>    end
>    - def authorized_for_new? # in model, out of desperation
>      false
>    end
>    - def create_authorized? # in controller
>      false
>    end
>
> What is the right way?
>

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/activescaffold/-/GbvZHQglRm4J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Reply via email to