Skip to content

Commit

Permalink
Merge pull request #423 from Shopify/fix-shop-migration-generator
Browse files Browse the repository at this point in the history
Added Rails version to create_shops generator template
  • Loading branch information
AWaselnuk committed Jun 15, 2017
2 parents 31eae39 + 9088812 commit 97a6110
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
7.2.10
-----
* Fix an issue with the create_shops generator template
[[#423]](https://github.com/Shopify/shopify_app/pull/423)

7.2.9
-----
* Remove support for Rails 4
Expand Down
10 changes: 3 additions & 7 deletions lib/generators/shopify_app/shop_model/shop_model_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def create_shop_model
end

def create_shop_migration
copy_migration 'create_shops.rb'
migration_template "db/migrate/create_shops.erb", "db/migrate/create_shops.rb"
end

def create_session_storage_initializer
Expand All @@ -25,12 +25,8 @@ def create_shop_fixtures

private

def copy_migration(migration_name, config = {})
migration_template(
"db/migrate/#{migration_name}",
"db/migrate/#{migration_name}",
config
)
def rails_migration_version
Rails.version.match(/\d\.\d/)[0]
end

# for generating a timestamp when using `create_migration`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreateShops < ActiveRecord::Migration
class CreateShops < ActiveRecord::Migration[<%= rails_migration_version %>]
def self.up
create_table :shops do |t|
t.string :shopify_domain, null: false
Expand Down
2 changes: 1 addition & 1 deletion lib/shopify_app/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ShopifyApp
VERSION = '7.2.9'
VERSION = '7.2.10'
end

0 comments on commit 97a6110

Please sign in to comment.