Top Level Namespace

Defined Under Namespace

Modules: Breezy, Rails

Instance Method Summary collapse

Instance Method Details

#add_member_methodsObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/install/web.rb', line 5

def add_member_methods
  inject_into_file "app/models/application_record.rb", after: "class ApplicationRecord < ActiveRecord::Base\n" do
    <<-RUBY
  def self.member_at(index)
    offset(index).limit(1).first
  end

  def self.member_by(attr, value)
    find_by(Hash[attr, value])
  end
    RUBY
  end
end