Displaying 2 results from an estimated 2 matches for "business_unit_id".
2010 Oct 06
2
reflect_on_association method
...reflect_on_association
method with given the simplified model:
class Order < ActiveRecord::Base
belongs_to :contractor, :class_name => "BusinessUnit"
end
I expected the reflect_on_association method to return
associated_foreign_key "contractor_id" but it returns
"business_unit_id":
ruby-1.9.2-p0 >
Order.reflect_on_association(:contractor).association_foreign_key
=> "business_unit_id"
do I miss something?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send em...
2006 Feb 25
7
Help with DRY: too much code in my view
...multiple tables
into one view. For example, for a list view of "projects" (main table),
I have this code in the list.rhtml:
<%
odd_or_even = 0
for project in @projects
@project_translations = ProjectTranslation.find(project.id)
@business_unit = BusinessUnit.find(project.business_unit_id)
@requestor = User.find(project.requester_user_id)
@vendor_projects =
VendorProject.find_by_project_translation_id(@project_translations.id)
@vendor = Vendor.find(@vendor_projects.vendor_id)
odd_or_even = 1 - odd_or_even
%>
This code I would probably need in other views as well. For...