Rails 5 join table naming conventions

in code


This is a stupid fucking thing, but here we are. My underling and I wasted 40 minutes today re-figuring this out.

Migration:

class PluralSingular < ActiveRecord::Migration[5.0]
  create_join_table :plural, :plural
end

Model:

app/model/foo.rb

class Foo < ApplicationRecord
  has_many :plural_singular
  has_many :plural, through: :plural_singular
end

Join model:

app/model/plural_singular.rb

class PluralSingular < ApplicationRecord
  belongs_to :foo
  belongs_to :bar
end


Remap a JavaScript Object

in code

Coffee is Good

in code


Your email address will not be published. Required fields are marked *