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