Ruby on Rails Saturday, October 15, 2016

On 15 October 2016 at 10:07, Usman Shahid <usman.shaahid@gmail.com> wrote:
I cannot find an alternative to this. What i'm trying to do is write a generic interface which can answer generic queries like search based on specific column and aggregate queries etc. Underlying table is provided to the Model on initialization and I want it hooked with that table so that I can run these active record generic queries (and some generic extensions) on the underlying table.

Also, how do I hack it? Is there any downside of doing it?

If you want methods available in a number of models you can derive an intermediary class from ActiveRecord base, provide the methods in there, and derive your models from the intermediary.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtWZkWbf6PnbWEQm%2B5FRErt7Jsydtc-p0Op1CrBx5O%2BhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment