I need to get a hold of the current record inside of the function that Volker defined (in the ApplicationController). I'm not showing current_record, in that context, to exist

class ApplicationController<  ActionController::Base
ActiveScaffold::Actions::Delete.class_eval do
   def delete_authorized?
     #current_record here...
   end
end
end



On 09/17/2010 07:55 AM, Sergio Cambra .:: entreCables S.L. ::. wrote:
On Viernes, 17 de Septiembre de 2010 15:17:01 Michael Bahnmiller escribió:
Next question on this....

How can I get a hold of the current record that is being checked when
this code is run?

current_record is self, you are adding an instance method.

THANKS!

Mikelb

On 09/17/2010 12:23 AM, [email protected] wrote:
Hi,

that s because mixed in module methods have a higher priority than
methods of a parent class.
That means your method in Application controller never gets called.

One easy way to fix this would be to directly override method in
module delete:
ActiveScaffold::Actions::Delete.class_eval do
    def delete_authorized?
      false
    end
end

--
Volker

On Sep 17, 8:03 am, mikelb<[email protected]>   wrote:
I am trying to use this:

http://wiki.github.com/activescaffold/active_scaffold/security

to restrict the delete action.  The conditions for this will be the
same across *all* controllers.  So, I thought that it would be logical
to place the "delete_authorized?" method in the
ApplicationController.  But when I do that, nothing happens.  When I
place it in the individual controller, I get what I should... it
filters the delete action.

The function that I am using is defined thus (to keep it simple, for
testing purposes):

def delete_authorized?
      false
end

Any help would be great!

Thanks,
Mikelb

--
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.

Reply via email to