I defined a new method in my controller to show customized show page for my houses after one click on search results.
houses_controller.rb
def show_house_search
@house = House.find(params[:id])
@photos = @house.photos
end
then I declared the routes in routes.rb
get '/show_house_search/:id', to: 'houses#show_house_search', as:'show_house_search'
and when I am using it as
<%= link_to show_house_search_path(house.id),id:'house_search' do %>
<li id="house-<%= house.id %>">
<span class="user" style="font-size: 15px;font-weight: 200;text-decoration: dotted;"><%= house.title %></span>
<span class="content"style="font-size: 15px;color: purple;font-weight: 600;">Price <i class="fa fa-inr"></i><%= house.price %></span>
<span class="badge"><%= house.house_structure%></span> </span>
<span class="badge"><%= house.location%></span> </span>
</li>
<%end%>
clicking on this link is showing me this error:
Routing Error
No route matches [GET] "/show_house_search.38"
while I also searched for a route for my request using rails routes
show_house_search_path GET /show_house_search/:id(.:format) houses#show_house_search