Hi Josh, Couple of questions: Does Plugin.log_environment = set which ones to log or which ones to exclude? Maybe make it Plugin.log_only_enviroments or Plugin.log_except_enviroments. Also I'm thinking you'll nedd to be able to set one or more enviroments instead of just one like you've specified... is that true?
So that starts to get complicated. A better form might be to have a Plugin.logger_on class variable that is either true or false. You can set it's state in the /config/enviroments/development.rb (or test.rb or production.rb, etc) Then your not worried about the array problem and the variable name is more discriptive (its either on or off). In the end the method which does the logging needs to check the variable state and either return if false or do the logging if true. Hope That Helps, Rob On Tue, May 6, 2008 at 9:51 PM, Josh N. Abbott <[EMAIL PROTECTED]> wrote: > > Hey guys, > > I'm working on a plugin to log what users are doing in the admin. > However, I want to be able to specify that in not work in certain > environments (ie. development env for testing or when using console > when there is no user) by setting this in the environment.rb: > > Plugin.log_environment = 'development' > > And this method is in the plugin: > > def self.log_environment=(env) > end > > The question is, what should be in that method to make sure that the > plugin doesn't actually fire the method that saves the log? > > Is this even the best way to do this? > > Thanks, > Josh > > > --~--~---------~--~----~------------~-------~--~----~ SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby -~----------~----~----~----~------~----~------~--~---
