Sha256: fe7e40615f4e341361e02eb7156b1b1ea5291aa314dbeac7d21ce276e9b71778
Contents?: true
Size: 534 Bytes
Versions: 5
Compression:
Stored size: 534 Bytes
Contents
require 'rails/generators/active_record' module SecondStep class UserRelationshipGenerator < Rails::Generators::Base argument :model, type: :string, default: 'User', description: 'User Model' def add_relation model_file_name = options.model.underscore << '.rb' model_path = Rails.root.join 'app', 'models', model_file_name inject_into_class model_path, options.model, <<-RUBY has_one :second_step_application_user, class_name: 'SecondStep::ApplicationUser', foreign_key: :user_id RUBY end end end
Version data entries
5 entries across 4 versions & 1 rubygems