Tagged:activerecord

Tipos de datos para migraciones de ActiveRecord

Al realizar el andamiaje (scaffolding) de un nuevo objeto en Rails siempre tenía la duda de qué tipos eran los que podía utilizar. Después de dar algunas vueltas encontré que los tipos disponibles para ActiveRecord de Rails 4.2.0 son los siguientes:

  • :primary_key,
  • :string,
  • :text,
  • :integer,
  • :float,
  • :decimal,
  • :datetime,
  • :time,
  • :date,
  • :binary, y
  • :boolean

La fuente de esta información es la documentación de ActiveRecord, que al final siempre termina siendo la mejor para informarnos de este tipo de cosas, a pesar de que no es muy amigable:
http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html#method-i-column

{ Piensa / Think }

"This is a waste of life. [...] the entire educational system in the modern day is nothing more than a cookie cutter processing plant that prepares humans for mostly predefined occupational roles. This element of human life has become so traditionally ingrained, that many falsely consider the nature of ‘having a job’ some form of human instinct. Even parents will ask their kids “What do you want to be when you grow up?” as though there was only one thing. This is disturbing and a violation of human potential." - The Zeitgeist Movement


"He aprendido que hay cosas que pueden ser comprendidas pero que nunca podrán ser explicadas con palabras sin desvirtuar su grandeza" - Andrés Pascual


"You never change things by fighting the existing reality. To change something, build a new model that makes the existing model obsolete." - Buckminster Fuller


"... I am the master of my fate. I am the captain of my soul." - William Ernest Henley