[Ror-es] sintaxis en rails

Patrick Aljord patcito at gmail.com
Thu Dec 20 17:33:01 GMT 2007


On Dec 20, 2007 3:05 PM, Gabriel Sosa <sosagabriel at gmail.com> wrote:
> buenas,
> estoy haciendo mi primera aplicacion en rails luego del querido tuto de
> recetario que anda por ahi.
>
> por ahi estoy volando pero ustedes me dicen.
>
> tengo el modelo cliente y cual tiene dos attributos: warning_timeout y
> danger_timeout
> ademas de updated_at

pero warning_timeout es un integer o un Date o Time?


>     if (self.updated_at - time).to_int > self.warning_timeout

si warning_timeout es un date o time, tienes que hacer:

 if (self.updated_at - time).to_i > self.warning_timeout.to_i

si warning_timeout es un integer, puedes hacer:

if (self.updated_at - time) > self.warning_timeout.days


More information about the Ror-es mailing list