diff --git a/app/controllers/recipes_controller.rb b/app/controllers/recipes_controller.rb index 238535b..b0557a5 100644 --- a/app/controllers/recipes_controller.rb +++ b/app/controllers/recipes_controller.rb @@ -100,19 +100,22 @@ def recipe_params :name, :summary, :description, - :prep_times, + :prep_times, # fails assert always valid :servings_made, :feeds, :user_id, - # :picture, - # :chef_id, - # style_ids: [], - # ingredients_attributes: [:id, :name, :_destroy], - # directions_attributes: [:id, :name, :step, :_destroy], - # feed_ids: [], - # calorie_ids: [], - # preptime_ids: [] + + :picture, + style_ids: [], + ingredients_attributes: [:id, :name, :_destroy], + directions_attributes: [:id, :name, :step, :_destroy], + + # calorie_ids: [], # Need to replace + + # preptime_ids: [] # Don't use anymore + # feed_ids: [], # Don't use anymore + # :chef_id, # Don't use anymore ) end diff --git a/app/models/recipe.rb b/app/models/recipe.rb index 4de0c98..a2d6a5f 100644 --- a/app/models/recipe.rb +++ b/app/models/recipe.rb @@ -6,14 +6,21 @@ class Recipe < ActiveRecord::Base has_many :ingredients has_many :directions has_many :reviews - has_many :recipe_calories has_many :comments, as: :commentable - has_many :calories, through: :recipe_calories - has_many :recipe_preptimes - has_many :preptimes, through: :recipe_preptimes + has_many :recipe_feeds - # Going to a integer & no relationship + ### Going to a integer & no relationship #### + ### Going to a integer & no relationship #### + # has_many :feeds, through: :recipe_feeds + # has_many :recipe_preptimes + # has_many :preptimes, through: :recipe_preptimes + has_many :recipe_calories + has_many :calories, through: :recipe_calories + + ### Going to a integer & no relationship #### + ### Going to a integer & no relationship #### + # searchkick accepts_nested_attributes_for :ingredients, reject_if: proc { |attributes| attributes['name'].blank? }, diff --git a/app/views/recipes/index.html.erb b/app/views/recipes/index.html.erb index 0aee9cb..85fcc84 100644 --- a/app/views/recipes/index.html.erb +++ b/app/views/recipes/index.html.erb @@ -33,11 +33,10 @@
Ingredients: <%= render recipe.ingredients %>
<% end %> -Feeds: <%= recipe.feeds %>
+Feeds: <%= recipe.feeds %>
+ +Preptime: <%= recipe.prep_times %>
- <% if recipe.preptimes.any? %> -Preptime: <%= render recipe.preptimes %>
- <% end %>
Created: <%= time_ago_in_words(recipe.created_at)%> ago
diff --git a/app/views/recipes/show.html.erb b/app/views/recipes/show.html.erb
index 2eb1621..df83224 100644
--- a/app/views/recipes/show.html.erb
+++ b/app/views/recipes/show.html.erb
@@ -35,10 +35,8 @@
<% end %>
Feeds: <%= @recipe.feeds %>
+Preptime: <%= @recipe.prep_times %>
- <% if @recipe.preptimes.any? %> -Preptime: <%= render @recipe.preptimes %>
- <% end %>Notes:
<%= simple_format(@recipe.description) %>