Guest User

Untitled

a guest
Jun 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1.  
  2. Tag
  3.  
  4. id
  5. name
  6.  
  7. has_many :offer_items
  8. has_many :offers, :through => :offer_items
  9.  
  10. Offer_item
  11.  
  12. id
  13. tag_id
  14. source_id
  15.  
  16. belongs_to :source
  17. belongs_to :tag
  18.  
  19. Action:
  20.  
  21. @offer_item = OfferItem.find(params[:id])
  22.  
  23. def redirect
  24. redirect_to @offer_item.offer.url
  25. puts "Nu vet vi vilken tag han kom igenom: #{offer_item.tag}"
  26. end
  27.  
  28. Offer
  29.  
  30. id
  31. url
  32. caption
  33. description
  34.  
  35. has_many :offer_items
  36. has_many :tags, :through => :offer_items
Add Comment
Please, Sign In to add comment