Hi, Unfortunetly, I ve got no experiences with cancan bridge, but I would say that you are not facing an authorization issue... You would like to show/hide an action link depending on the value of a model attribute. I would say that s not an authorization question.
Maybe you can take a look at http://vhochstein.wordpress.com/2010/09/30/actionlink-response-and-ignore/ Please check the ignore action_link option, which might be a more appropriate solution for your issue. -- Volker On May 4, 8:13 pm, "[email protected]" <[email protected]> wrote: > I am trying to use the security feature on my Users activescaffold. I > want to display an action link, 'activate_by_id', when a user's record > has a nil value on the field activated_at. > > I followed the directions 'To enable or disable action links on a per > record basis' > -https://github.com/activescaffold/active_scaffold/wiki/API:-Action-Link > as well as reading several comments in he discussion group. I'm not > sure what is wrong, but AS does not seem to recognize or obey the > 'authorized_for_activate_by_id?' method in my User model. I have also > tried with 'authorized_for_delete?'. > > I am using rails 3.0.3 and latest version of AS branch. I am also > using the CanCan bridge (could this conflict?). > > Below are my models and controllers for this active scaffold. Any > suggestions on getting my action_link to obey the authorized_for > definition? Currently no authorized_for function in the model seems > to have an affect on the display of the action links at all. > > Controller: > > class UsersController < ApplicationController > # Be sure to include AuthenticationSystem in Application Controller > instead > include AuthenticatedSystem > > layout "activescaffold" > active_scaffold :users do |config| > config.action_links.add 'activate_by_id', > :action=>"activate_by_id", > :type=>:member, > :inline =>true, > :crud_type=>:update > end > > def activate_by_id > #logout_keeping_session! > debugger > user = User.find_by_id(params[:id]) unless params[:id].blank? > user.activate! > end > end > > Model: > > def authorized_for_activate_by_id? > false > end > > def authorized_for_delete? > false > end -- You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group. 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.
