jeudi 21 mai 2015

How to Add References in Rails 3?

I have a has_many :through relationship for users through affinities.

I want to add references to the affinity model for a user and the corresponding like_user.

When I try to run the command: rails g migration AddUserRefToAffinities user:references..... I get a migration with: add_column :affinities, :user, :references

It should be: add_reference :affinities, :user, index: true

How can I accomplish this? All help is appreciated! Thanks!!!

Aucun commentaire:

Enregistrer un commentaire