Vertaling van "ActiveModel" in Engels
We konden deze vermelding niet vinden. Er worden benaderende resultaten weergegeven. Controleer je spelling of stel voor deze term aan het woordenboek toe te voegen.
Por suerte podemos recuperar esta funcionalidad utilizando ActiveModel.
Fortunately, we can restore this functionality by using ActiveModel.
Por tanto podemos hacer que nuestro modelo funcione incluyendo un par de módulos de ActiveModel.
We can make our model work by including a couple of ActiveRecord modules.
Sin embargo aunque ActiveModel está muy bien no resulta conveniente su uso directo de esta manera.
ActiveModel is great but isn't very convenient to use directly like this.
Tal y como puede verse del listado anterior ActiveModel incluye entre otras cosas el código para gestionar callbacks, serialización y validación.
We can see from the list above that ActiveModel includes code to handle callbacks, dirty tracking, serialization and validation, among other things.
Si echamos un vistazo al directorio que contiene el código de ActiveModel podemos ver toda la funcionalidad que suministra.
It we take a look in the directory that contains the code for ActiveModel we can see the functionality that it provides.
En este episodio hemos visto solo un poco de todo lo que ActiveModel nos ofrece, pero debería ser suficiente para despertar nuestro interés y darnos una razón para examinar su documentación y aprender todo lo que puede hacer.
We've only covered a little of what ActiveModel provides in this episode but this should have been enough to whet your appetite and give you a reason to look more deeply into its source code to see what it can do.
Antes de entrar en detalle con ActiveModel vamos a describir la sección de la aplicación que vamos a modificar
Before we get into the details of ActiveModel we'll first describe the part of the application that we're going to modify to use it.
En vez de tener que adivinar todo lo que Rails espera que nuestro modelo tenga, podemos usar una herramienta de chequeo incluida con ActiveModel que nos permite comprobar si nuestro modelo cumple con todo lo que Rails espera de él.
Rather than guessing everything that Rails expects the model to have there's a nice lint test included with ActiveModel that allows us to check whether our custom model behaves as Rails expects it to.
Si incluimos el módulo ActiveModel::Lint::Tests en un test del modelo, comprobará que éste tiene toda la funcionalidad necesaria.
If we include the ActiveModel::Lint::Tests module in a tests for the model it will check that the model has all of the required functionality.
Podría decirse que esta técnica era un hack, dado que no era algo para lo que ActiveRecord estuviera diseñado pero ahora en Rails 3.0 tenemos una nueva funcionalidad llamada ActiveModel con la que se pueden hacer fácilmente este tipo de cosas.
The technique we used was quite a hack as this is something that ActiveRecord wasn't designed to do but now in Rails 3.0 we have a new feature called ActiveModel which makes doing something like this a lot easier.
Su autor Chris Greigo la describe como "lo que se le pasó a ActiveModel" que es una descripción bastante acertada de lo que hace.
It's described by its author Chris Greigo as "what ActiveModel left out" which is a fair description of what it does.
Una diferencia importante es que se han sacado las validaciones de ActiveRecord y se han puesto en ActiveModel.
One important difference is that the validations have been moved out of ActiveRecord into the new ActiveModel.
Si echamos un vistazo al código fuente de Rails 3 veremos que hay un par de directorios, activerecord y activemodel.
If we take a look at the Rails 3 source code we'll see the that there are activerecord and activemodel directories.