if !@user.business_admins.nil?
puts "Am here"
@business_admin = @user.business_admins[0]
end
class User < ActiveRecord::Base
has_many :business_admins
end
class BusinessAdmin < ActiveRecord::Base
belongs_to :user
end
Here what i am trying, I am using Mozilla rest-client, basically here the *
user_name* found in the *User* table, But i didn't put that id in the *
BusinessAdmin*, So what the problem is when i run the code, this *if
!@user.business_admins.nil?* will return *true*, because am getting this *"Am
here"
*Have any issues with this model??...*
*
Thankyou
Vishnu*
*
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Wh5IbFmxT-0J.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.