Commit
…created Signed-off-by: José Valim <jose.valim@gmail.com>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
class <%= migration_class_name %> < ActiveRecord::Migration | ||
def self.up<% attributes.each do |attribute| %> | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
lukaszx0
Member
|
||
<%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><% end -%> | ||
<%- end %> | ||
<%- if migration_action -%> | ||
<%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><% end %> | ||
<%- end -%> | ||
<%- end -%> | ||
end | ||
def self.down<% attributes.reverse.each do |attribute| %> | ||
<%= migration_action == 'add' ? 'remove' : 'add' %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'remove' %>, :<%= attribute.type %><% end -%> | ||
<%- end %> | ||
<%- if migration_action -%> | ||
<%= migration_action == 'add' ? 'remove' : 'add' %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'remove' %>, :<%= attribute.type %><% end %> | ||
<%- end -%> | ||
<%- end -%> | ||
end | ||
end |
When creating a migration, now it shows up with no new line but instead just
def self.up end
rather thandef self.up\n
like so: https://gist.github.com/33a65ec8e77eeac4a5eb