[Activerdf] Validations,
Callbacks (and other ActiveRecord goodies) on ActiveRDF
Demetrius Nunes
demetriusnunes at gmail.com
Wed Jul 26 16:58:15 IST 2006
Eyal,
The main concerns are about the methods that control the persistence
life-cycle of the object, such as the finders, instantiation, create,
update, save and destroy.
Particularly, the create method in ActiveRDF sounds a little odd to me
since it does not in fact create a new object if you pass it an
existing object URI. I think this method should definately be
re-implemented by the #find(uri) and #new methods as in ActveRecord.
#create should be used to persist a new object to the underlying
database.
Having the life-cycle methods API compatible with ActiveRecord would
already enable us to mix-in the callbacks and observer extensions.
As for the validations extension, there´s a little more that must be
done for that to work, because the validations must have access to a
attributes collection and some other methods (such as new_record?)
should be defined. Take a look here for some hints:
http://wiki.rubyonrails.com/rails/pages/HowToUseValidationsWithoutExtendingActiveRecord
So, let me know if I should go in that direction already or wait for 0.3.
On 7/22/06, Eyal Oren <eyal.oren at deri.org> wrote:
> On 07/22/06/07/06 05:46 -0300, Demetrius Nunes wrote:
> >I am already stumbling on a lot of problems replacing SemanticRecord
> >for ActiveRDF because I am loosing all those functionalities provided
> >by ActiveRecord's mentioned extensions, mainly the validations and
> >callbacks (but also observer, timestamp, and others).
> >
> >So, this come down to the suggestion that maybe we should strive to
> >keep some level of ActiveRDF's API compatibility with ActiveRecord in
> >a way that we could leverage some of those nice extensions.
> Yes, we should definitely!
>
> Can you indicate specifically which parts of ActiveRDF do not conform to
> which parts of ActiveRecord's API? I definitely would like to get that
> fixed! As I mentioned earlier, I'm not much of a Rails hacker and I just
> don't know which parts of ActiveRDF are not API compliant: I appreciate
> every piece of information you can give.
>
> >That said, I've just watched DHH keynote about CRUD and ActiveResource
> >and during the Q&A session at the end, he talked about abstracting an
> >"ActiveModel" class so all those extensions would be coupled with this
> >higher abstraction and make ActiveRecord, ActiveResource, and others,
> >just subclasses of ActiveModel.
> Ok. I saw the ActiveResource webcast, but didn't see that part about
> ActiveModel; do you know what the status is of such ActiveModel API?
>
> -eyal
> _______________________________________________
> Activerdf mailing list
> Activerdf at lists.deri.org
> http://lists.deri.org/mailman/listinfo/activerdf
>
More information about the Activerdf
mailing list