Joshua :
I have the following controller:
class MemberController < ApplicationController performs_authentication :user_model_class => Member performs_scaffolding :only => [:show, :edit], :model_id => user.id ... end
The first statement, performs_authentication, adds an instance method "user" to the controller, which I want to use in the second statement (see code above). Sadly, I'm getting the following error:
undefined local variable or method `user' for MemberController:Class
Is this normal behavior, that one can't use a method, added by one plugin, immediately? Or must I have done something wrong...?
You're in the context of the class not of an instance. performs_scaffolding is a class method, and if you write user.id, user should be a local variable or a class method.
Since user is an instance method and you're not manipulating an instance of MemberController, it doesn't work.
I don't know what really you want to do with :model_id => user.id but you may look at creating a Proc object that you will be called later in the right scope at the right moment.
See the :if => Proc.new { .. } option in validations macros for an example.
HTH,
-- Jean-François.