remco
1
I have the following setup
class Education < ActiveRecord::Base
has_and_belongs_to_many :users
end
class User < ActiveRecord::Base
has_and_belongs_to_many :educations
end
In my user-view-rhtml i have:
<% @user.educations do |education| %>
<li><%= education.name%></li>
This generates empty data…
Question…is my .rhtml wrong or my models??
remco
2
On 8 Nov 2007, at 15:01, Remco S. wrote:
In my user-view-rhtml i have:
<% @user.educations do |education| %>
<li><%= education.name%></li>
That seems ok.
Fred
remco
3
Frederick C. wrote:
On 8 Nov 2007, at 15:01, Remco S. wrote:
In my user-view-rhtml i have:
<% @user.educations do |education| %>
<li><%= education.name%></li>
That seems ok.
Fred
yep…i thought so
There is a join table education_user involved…that is the problem…i
guess…
remco
4
I think the problems is in the iteration in your view, it should be:
<% @user.educations.each do |education| %>
<%= education.name%>
CU
Geoffroy G.
Joan Gu wrote:
–
Posted via http://www.ruby-forum.com/.
–
View this message in context:
http://www.nabble.com/Correct-HABTM-of-use-has_many-%3Athrough--tf4771440.html#a13762790
Sent from the RubyOnRails Users mailing list archive at Nabble.com.