Reputation: 853
In an application a developer written code as
show.html.slim
= render @driver.trips.order("id DESC"), show_driver: false
The application dont have any partials like _driver.html.erb in the same resource.
In that page it shows all trips of a driver except driver name attribute.
another code snippet
= render Trip.order("id DESC"), show_driver: true
Model association is
driver has_many :trips
trip belongs_to :driver
Is it possible to pass query as a param to render? and which route it states?
Upvotes: 1
Views: 125
Reputation: 44685
You can pass whatever you want to render, as long as it defines to_partial_path
or is a collection of such objects. ActiveRecord defines it (this is primarily how it is used).
You mentioned that there is no _driver
partial, however, what you should be looking for is trips/_trip
.
Upvotes: 2