Sha256: b3340a8a7ce3fedbaf4674d79232165d0cd148d27a32285453bd3f7aa5fa99f4
Contents?: true
Size: 1.13 KB
Versions: 26
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true require 'rails/generators/base' require 'rails/generators/active_record' module ShopifyApp module Generators class UserModelGenerator < Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path('../templates', __FILE__) def create_user_model copy_file('user.rb', 'app/models/user.rb') end def create_user_migration migration_template('db/migrate/create_users.erb', 'db/migrate/create_users.rb') end def update_shopify_app_initializer gsub_file('config/initializers/shopify_app.rb', 'ShopifyApp::InMemoryUserSessionStore', 'User') end def create_user_fixtures copy_file('users.yml', 'test/fixtures/users.yml') end private def rails_migration_version Rails.version.match(/\d\.\d/)[0] end class << self private :next_migration_number # for generating a timestamp when using `create_migration` def next_migration_number(dir) ActiveRecord::Generators::Base.next_migration_number(dir) end end end end end
Version data entries
26 entries across 26 versions & 1 rubygems