I believe the argument in the *_authorized? methods in the controller needs
to have a default, because in some places within active_scaffold they are
called without an argument.

For example:

def update_authorized?(record = nil)
   current_user.update_allowed?
end

On Sun, Oct 16, 2011 at 6:09 PM, JB <[email protected]> wrote:

> Does anyone have any experience with using ActiveScaffold security?
> I'm just doing a test to see how to get things working, without
> success.
>
> I've defined this in my ApplicationController:
>
>  ActiveScaffold.set_defaults do |config|
>    config.security.current_user_method = :current_user
>    config.security.default_permission = false
>  end
>
> And this in my model's controller:
>
>  def create_authorized?
>       true
>  end
>
>  def show_authorized?(record)
>       true
>  end
>
>  def list_authorized?
>       true
>  end
>
>  def update_authorized?(record)
>       true
>  end
>
>  def delete_authorized?(record)
>       true
>  end
>
> And this on my model:
>
>  def self.authorized_for_create?
>    true
>  end
>
>  def authorized_for_read?
>    true
>  end
>
>  def authorized_for_update?
>    true
>  end
>
>  def authorized_for_delete?
>    true
>  end
>
> When I go to the index page for my model, I get a table, but none of
> the columns show up. For each record I see an Edit, Delete, and Show
> button. I also see the Create New link at the top of the table. When I
> click the Create New button, I get a blank form. And the Edit, Delete,
> and Show buttons all fail with the following:
>
> 17:05:41 web.1     | ArgumentError (wrong number of arguments (0 for
> 1)):
> 17:05:41 web.1     |   app/controllers/sub_contractors_controller.rb:
> 15:in `show_authorized?'
>
> Any suggestions on where to go from here?
>
> --
> 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.
>
>

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