Long story short, I have models relationships defined like this:
Project has_many :groups
Group has_many :items
My goal is to make item names unique inside the project scope. Since :items
table does not have project_id
foreign key defined, simply writing
add_index :items, :name, unique: { scope: :project_id }
will not work. I'm new to rails, am i missing something? How can this problem be solved?