Today I have tried to do this: let any application application, and among all the tables to storage the data of your model estructure, there is one called «Configuration». As you can suspect, this table will storage some configuration options for your application. For some configuration options you need to execute certain code, and here is what I’ve tried:
class Configuration < ActiveRecord::Base # These next lines are related to Hobo gem, and are just # an expression to define the model (you can imagine what they do for sure) fields do name :string value :string callback :boolean, default => false callback_name :string end after_update self.callback_name.to_sym, :if => self.callback? ... here comes the definition of each callback ...
For some reason this is not allowed. I think this is a nice solution to hook configuration options within code, but it doesn’t seem to work :/
If any of you get something like this working, please let me know, I will own a beer (no alcohol obviously 🙂
Cheers, Ibon.