pratik
pratik

Reputation: 64

RefineryCMS with mutliple associated model in rails

I searched everything about how to generate association between two or more model using "RefineryCMS". I followed everything from this URL https://github.com/refinery . I want to create two model with association.

Anyone can please help me

Upvotes: 1

Views: 436

Answers (1)

androidharry
androidharry

Reputation: 197

If you want to relate models from two different refinery engines you can do something like this. Suppose you have a User engine and a Post engine and you want to define user has_many posts between the models of these two engines.

In the user.rb in the User engine add

has_many :posts, :class_name => Refinery::Posts::Post

and in the post.rb add

belongs_to :user, :class_name => Refinery::Users::User

Upvotes: 3

Related Questions