Closed clubbavi closed 9 years ago
:include => [:assoc1, {:assoc2: => {:assoc3 => [:assoc4, :assoc5] }} ]
Just one question on this: If I want to show the has_may relations in multiple lines, then what is the correct syntax for that?
As : g.column :column_name => 'Category',:attribute_name => 'name', :model_class=> 'ArticleCategory' do |administrator_article| administrator_article.article_categories.collect{|ac| ac.name}.join(',') end
this will bring the data in one line. If I want to show these in multiple lines?
I assume this is a many-to-many association. And you want to have a line per each combination of article/category, right? Then you should create an AR model for your many-to-many join table, and have a grid for this model instead of a grid for articles.
Does it make sense?
Please use github markdown!
The other way around. Yes, I got that. It is now working as expected. Thanks a lot.
Hello,
How can I use wice grid if I have multiple nested models? Ex: A has_many :B, B has_many :C. How can we access C in this case? initialize_grid(A, :include => [:B] and then?
Can anyone help?
Thanks