ActiveData Re: [Rails-core] "ActiveRecord" for Non-SQL Data Sources?

Dr. Ernie Prabhakar drernie at opendarwin.org
Wed Feb 22 21:34:05 GMT 2006


Hi Kevin et al,

Thanks very much for the encouragement and advice.  Just to  
summarize, the best plan appears to be:

a) Create a plugin ("activedata")
http://wiki.rubyonrails.org/rails/pages/HowTosPlugins

b) Define my own module containing my custom classes ("ActiveData")

c) Define a new generic Query object, and test it for backward- 
compatibility ("ActiveData::Query")

d) Define subclasses for methods I want to override, e.g.,
     * ActiveData::Base << ActiveRecord::Base, for generic queries/ 
updates
     * ActiveData::Adapter <<  
ActiveRecord::ConnectionAdapters::AbstractAdapter, to vend Query object

e) Implement the CoreData adaptor and query, as a separate subclass  
(module?)

f) Write unit tests validating all the above

And if this all works, then we can discuss whether it makes sense to  
refactor parts of ActiveRecord (perhaps for Rails 2.0) --  but right  
now that would be premature.

Is that an accurate summary?  Any other suggestions/advice/links/ 
warnings?

Thanks,
-- Ernie P.

On Feb 13, 2006, at 8:16 PM, Kevin Clark wrote:

> Ernie,
> I think it is great that you were able to modify ActiveRecord for you
> needs.  You might want to pull your changes into a plugin where others
> could easily use your new code. That being said, I don't think
> something like this would go well in core. Plugins were created
> exactly for this situation though, so all is well.
> Kev
>


On Feb 13, 2006, at 8:28 PM, Nathaniel S. H. Brown wrote:
> This seems a little OT, but you might find it useful.
>
> Emil Marceta, a local Ruby guy here in Vancouver wrote this post to  
> the
> vanruby.com mailing list.
>
> http://lists.vanruby.com/pipermail/discuss/2006-January/000050.html
>
> It describes how to use ActiveRecord's validations against table- 
> less data
> model based on Rick Olsen's code here:
>
> http://rails.techno-weenie.net/tip/2005/11/19/ 
> validate_your_forms_with_a_tab
> le_less_model
>
> -Nb



On Feb 14, 2006, at 1:12 PM, Michael Koziarski wrote:
> The main problem with a large scale refactoring like this is the havoc
> that it brings to people's plugins and other people who make use of
> our implementation methods.  It's one of the reasons we can't change
> ActiveRecord::Base#quote to something that's less likely to clash.
>
> Perhaps another approach would be to try and refactor the parts of AR
> which aren't related to persistence (validation, attributes=, etc.) so
> they can simply be 'included' by other persistence mechanisms.
>
> Things like Rick's tableless models,  your own core data,  a refined
> active ldap, could really use this.    From there we can plan a way
> forward to make it easier to write custom persistence tools.


> http://lists.rubyonrails.org/mailman/listinfo/rails-core



More information about the Rails-core mailing list