search for: airline_id

Displaying 2 results from an estimated 2 matches for "airline_id".

2012 Sep 23
2
Find by id in the view template dynamically
Rails 3.1.3 I have a model ''Airline'', whose STRING column is ''company'' only. Also, another model ''Plan'' has an INTEGER column ''airline_id''. I would like to show the ''company'' name (string) in a template like <% @plans.each do |plan| %> Airline: <%= @airlines.find(plan.airline_id).first.company %><br /> ... <% end %> in the ''plans_controller.rb'...
2006 Jul 15
3
How bad is it to have 7 joins in my find_by_sql?
...id = accounts.id LEFT OUTER JOIN users on accounts.user_id = users.id LEFT OUTER JOIN airports AS origins ON activities.origin_id = origins.id LEFT OUTER JOIN airports AS destinations ON activities.destination_id = destinations.id LEFT OUTER JOIN airlines ON activities.airline_id = airlines.id LEFT OUTER JOIN programs ON accounts.program_id = programs.id LEFT OUTER JOIN membership_levels ON accounts.membership_level_id = membership_levels.id WHERE accounts.user_id = #{@session[:user].id} ORDER BY activities.date DESC LIMIT #{items_per_feed}"...