I just started using Active Admin Gem. I have a little bit of a problem and i was wondering if anyone had a solution.
I have two models
Dogs
Breeders
Using my application i would like to be able to
- find dogs breeds and then while viewing the dog have a list of breeders.
- When i visit the breeders (show page) i want to be able to see the dog breeds they have.
I have created the models but i am not sure how to accoumplish the task, However u have attempeted by creating a join table
breeders_dogs join table
class BreedersDogs < ActiveRecord::Migration
def self.up
create_table 'breeders_dogs', :id => false do |t|
t.integer :breeder_id
t.integer :dog_id
end
end
def self.down
drop_table :breeders_dogs
end
end
Dogs Model
class Dog < ActiveRecord::Base
has_and_belongs_to_many :breeders, :join_table => :breeders_dogs
end
Breeder Model
class Breeder < ActiveRecord::Base
has_and_belongs_to_many :dogs, :join_table => :breeders_dogs
end
I tried this but the situation is not the same. Using Rails Gem Active Admin with Associations
I am strugling on how to create this association between the two models. Thank you in advance.