Displaying 1 result from an estimated 1 matches for "reverse_foreign_key".
Did you mean:
reverse_foreign_keys
2013 Mar 11
0
Any interest in various features from "schema_plus" gem?
...# creates
a foreign key constraint to table posts
t.belongs_to :post, foreign_key: { on_delete: :cascade } # has various
options
connection.foreign_keys(table) #=> array of ForeignKeyDefinition
objects
# and add_foreign_key, remove_foreign_key,
connection.reverse_foreign_keys
# schema_plus actually has ''foreign_key: true'' as the default behavior,
for rails i''d probably make the default be false (configurable)
Views:
create_view :posts_commented_by_staff, Post.joins(comment:
user).where(users: {role: ''staff''}).un...