Forum: Ruby on Rails generate a migration (from a plugin) to add a column with a default value to an existing table

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
bide (Guest)
on 2009-01-27 13:03
(Received via mailing list)
I add a column to an existing table via the generator with the
following action:

  def cmi_local_assigns
    returning(assigns = {}) do
      assigns[:migration_action] = "add"
      assigns[:class_name] = "cmi_add_avatar_to_user#{class_name}"
      assigns[:table_name] = args[1]
      assigns[:attributes] = [
("user_avatar", "string")]

This works fine, bug now I want to add a default value for the newly
created column.
How is this possible?
The allows just two

Any ideas?
This topic is locked and can not be replied to.