This is probably an easy guess for some, but after searching the web
for quite some time, I’ve concluded that I need help understanding
this.
My case:
I’m creating an ad application where people can sell and buy items
through their own ads. An ad belongs to one category, and therefore
the question: When a user views all the current ads as a list
(webisteurl/ads) - how do I make the categories show up next to that
list like a clickable sorting menu?
(webisteurl/ads) - how do I make the categories show up next to that
list like a clickable sorting menu?
I’m not 100% sure which part you’re stuck on. To get the association
set up
you need to look in to ActiveRecord Relationships, in particular
has_and_belongs_to_many.
class Advert < ActiveRecord::Base
has_and_belongs_to_many :categories
end