J
Jacob Burkhart
[Note: parts of this message were removed to make it a legal post.]
I Can't seem to find any documentation or explanation as to why paramix has
been forcibly deprecated from facets:
http://facets.rubyforge.org/doc/changes.html
And apparently that lack of documentation means not too many other people
were making use of this cool tool.
You see a similar technique used a lot in rails. For example, you'll add
the make_resourceful plugin and now all of your controller have the class
method make_resourceful. (And that takes some arguments) And when you call
it ends up including some module from the plugin that adds things to your
controller. great.
But all of that takes a fair amount of up-front class_eval to add the
make_resourceful class method to everything.
For simple add-ons I like to use paramix.
For example, I have a simple module called SqlSearch, and I do
include SqlSearch, n => ['name', 'content']
paramix gives me access to those hash parameters in my self.included(base)
call in the module. So much simpler and cleaner than declaring class method
everywhere, and there's a clear and definite association here. You KNOW to
look for a SqlSearch module to find out what's going on I could instead
have defined the sql_search class method on ActiveRecord::Base... but then
I have to have require 'sql_search', I can't just have the const_missing
SqlSearch trigger the load needed.... messiness?
Anybody get what I'm talking about? Why get rid of such a useful thing?
What's a good alternative?
I debate making my own such thing, something like:
include_mod SqlSearch, n => ['name', 'content']
and then the callback is self.mod_included(base)... feels hackity
Any thoughts?
Jacob
I Can't seem to find any documentation or explanation as to why paramix has
been forcibly deprecated from facets:
http://facets.rubyforge.org/doc/changes.html
And apparently that lack of documentation means not too many other people
were making use of this cool tool.
You see a similar technique used a lot in rails. For example, you'll add
the make_resourceful plugin and now all of your controller have the class
method make_resourceful. (And that takes some arguments) And when you call
it ends up including some module from the plugin that adds things to your
controller. great.
But all of that takes a fair amount of up-front class_eval to add the
make_resourceful class method to everything.
For simple add-ons I like to use paramix.
For example, I have a simple module called SqlSearch, and I do
include SqlSearch, n => ['name', 'content']
paramix gives me access to those hash parameters in my self.included(base)
call in the module. So much simpler and cleaner than declaring class method
everywhere, and there's a clear and definite association here. You KNOW to
look for a SqlSearch module to find out what's going on I could instead
have defined the sql_search class method on ActiveRecord::Base... but then
I have to have require 'sql_search', I can't just have the const_missing
SqlSearch trigger the load needed.... messiness?
Anybody get what I'm talking about? Why get rid of such a useful thing?
What's a good alternative?
I debate making my own such thing, something like:
include_mod SqlSearch, n => ['name', 'content']
and then the callback is self.mod_included(base)... feels hackity
Any thoughts?
Jacob