Skip to content

Commit

Permalink
Added Rails version to create_shops generator template
Browse files Browse the repository at this point in the history
  • Loading branch information
AWaselnuk committed Jun 15, 2017
1 parent 31eae39 commit 84bb928
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
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

0 comments on commit 84bb928

Please sign in to comment.