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

Version Path
second_step-0.2.0 lib/generators/second_step/user_relationship_generator.rb
second_step-0.1.4 lib/generators/second_step/user_relationship_generator.rb
second_step-0.1.3 lib/generators/second_step/user_relationship_generator.rb
second_step-0.1.2 lib/generators/second_step/user_relationship_generator.rb
second_step-0.1.2 secondstep-notify-1.0.0-osx/lib/ruby/lib/ruby/gems/2.2.0/gems/second_step-0.1.1/lib/generators/second_step/user_relationship_generator.rb