Skip to content

Commit

Permalink
Fixes issue #2685
Browse files Browse the repository at this point in the history
In some instances, files are loaded in a different order and, given the
database migrations were modifying the properties of the attributes, it
was setting them back to `integer` and `photo_id` instead of `image` and
`photo`, so an image picker would not be displayed where it should be.
  • Loading branch information
parndt committed Apr 11, 2015
1 parent 04cc80f commit aa425f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Expand Up @@ -3,7 +3,8 @@ class Create<%= namespacing %><%= class_name.pluralize %> < ActiveRecord::Migrat
def up
create_table :refinery_<%= "#{namespacing.underscore}_" if table_name != namespacing.underscore.pluralize -%><%= table_name %> do |t|
<%
attributes.each do |attribute|
# We modify the attributes, so first we duplicate them.
attributes.dup.each do |attribute|
# turn image or resource into what it was supposed to be which is an integer reference to an image or resource.
if attribute.type.to_s =~ /^(image|resource)$/
attribute.type = 'integer'
Expand Down
Expand Up @@ -3,7 +3,8 @@ class Create<%= class_name.pluralize %> < ActiveRecord::Migration
def up
create_table :refinery_<%= table_name %> do |t|
<%
attributes.each do |attribute|
# We modify the attributes, so first we duplicate them.
attributes.dup.each do |attribute|
# turn image or resource into what it was supposed to be which is an integer reference to an image or resource.
case attribute.type
when :image, :resource
Expand Down

0 comments on commit aa425f7

Please sign in to comment.