Turns out the event table needed to have an artist_id column. I was
attempting to use the join table without a reference to the artist
table.
I dont know if that was the fix, because i also wrote a function in the
event model that used the artist_id to return artist data from the
database.
I did try your suggestion when initially building the classes...but
again, without the artist_id in the event table, it failed.
class Event < ActiveRecord::Base
has_many :city_events, dependent: :destroy
validates :EventID, uniqueness: true
def artist
Artist.find(artist_id)
end
def city
City.find(city_id)
end
end
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1e2f6f614609a96eb1f15c52d26255c7%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment