Hopefully the title makes some sense but I will go into more details. I have a simple app that allows users to upload recipes. You can then view them all or view each recipe individually via the show action
def show
@recipe = Recipe.find(params[:id])
end
In the view i then display various attributes for that recipe like so
<b><%= @recipe.dish_name %></b><br>
<b><%= image_tag @recipe.avatar.url(:showrecipe) %><b><br>
<b>by <%= @recipe.user.name %></b></br></br>
<b>Description</b></br>
<b><%= @recipe.description %></b></br>
<b>Ingredients</b></br>
<b><%= raw(ingredient_names_list(@recipe.ingredients)) %></b>
<br>
<b>Preperation Steps</b></br>
<ol>
<li><%= raw(preperation_steps_list(@recipe.preperations)) %></li>
</ol>
What I would like to achieve is to have a section on the same page that will list the names of other recipes that are LIKE the recipe being shown, based on dish_name
This is my first time doing something like this so i am looking for some pointers on what resources to look at or how i would go about this
My thinking so far is to
1) Create a method that calls a scope based on the dish_name being displayed, passing the params of the dish_name.
That may be wrong, just looking for a nudge in the right direction please
EDIT
I have also tried this in my show action but i get wrong number of arguments (1 for 0)
@relatedrecipe = Recipe.where(@recipe.dish_name('LIKE'),(params[:dish_name]))
Thanks