I have a search controller and index page:
# search/index.html.erb
<% @user_prices.each do |up| %>
# This needs to go to particular ID of UserPrice.
<%= link_to show_user_price_path do %>
<%= up.product_name %>
<% end %>
<% end %>
----------------------------------------------------------
class SearchController < ApplicationController
def index
@search = UserPrice.search do
fulltext params[:search]
paginate(:per_page => 5, :page => params[:page])
end
@user_prices = @search.results
end
end
Above you can see on my search form I am trying to link the product name to that particular UserPrice.How would I do this?
Thanks.
Not exactly sure why you’re using the block form of
link_to, if you check the link_to documentation there is an easier way to use the function to get what you want.