bide
2009-Jan-26 22:03 UTC
generate a migration (from a plugin) to add a column with a default value to an existing table
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] = [Rails::Generator::GeneratedAttribute.new
("user_avatar", "string")]
end
end
This works fine, bug now I want to add a default value for the newly
created column.
How is this possible?
The Rails::Generator::GeneratedAttribute.new allows just two
parameters.
Any ideas?
Thanks,
Bernd
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---