diff --git a/app/helpers/recipes_helper.rb b/app/helpers/recipes_helper.rb index 8a56d06..61e5e43 100644 --- a/app/helpers/recipes_helper.rb +++ b/app/helpers/recipes_helper.rb @@ -1,6 +1,6 @@ module RecipesHelper - def owner? + def recipe_owner? owner_check(@recipe.user_id) end diff --git a/app/helpers/workouts_helper.rb b/app/helpers/workouts_helper.rb index 2a4866a..b919788 100644 --- a/app/helpers/workouts_helper.rb +++ b/app/helpers/workouts_helper.rb @@ -1,7 +1,6 @@ module WorkoutsHelper - def owner? - # owner_check(@recipe.user_id) + def workout_owner? owner_check(@workout.user_id) end diff --git a/app/views/recipes/show.html.erb b/app/views/recipes/show.html.erb index 9b365b7..5548eda 100644 --- a/app/views/recipes/show.html.erb +++ b/app/views/recipes/show.html.erb @@ -50,7 +50,7 @@ <% end %> - <% if logged_in? and owner? %> + <% if logged_in? and recipe_owner? %> <%= link_to "Edit this Recipe", edit_recipe_path(@recipe), class: "btn btn-success pull-right edit" %> <%= link_to "[Delete Recipe]", @recipe, method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger pull-right delete"%> <% end %> @@ -73,7 +73,7 @@
<%= c.body %>
<%= c.updated_at.strftime("%m/%d/%Y") %> - <% if owner? %> + <% if recipe_owner? %> <%= link_to "Delete", review_recipe_path(:revid => c.id), class:"btn btn-danger btn-small pull-right", method: :delete, data: { confirm: "Are you sure you want to delete this review?" } %> <% end %> diff --git a/app/views/workouts/show.html.erb b/app/views/workouts/show.html.erb index bddb275..e546983 100644 --- a/app/views/workouts/show.html.erb +++ b/app/views/workouts/show.html.erb @@ -55,7 +55,7 @@ - <% if logged_in? and (owner? || current_user.admin?) %> + <% if logged_in? and (workout_owner? || current_user.admin?) %> <%= link_to "Edit this Workout", edit_workout_path(@workout), class: "btn btn-success pull-right edit" %>    <%= link_to "[Delete Workout]", @workout, method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger pull-right delete"%> @@ -81,7 +81,7 @@<%= c.body %>
<%= c.updated_at.strftime("%m/%d/%Y") %> - <% if owner_check(c.user) %> + <% if workout_owner? %> <%= link_to "Delete Review", review_workout_path(:revid => c.id), class:"btn btn-danger btn-small pull-right", method: :delete, data: { confirm: "Are you sure you want to delete this review?" } %> <% end %>