-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
goeun / edges / api muncher #40
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We talked about this in our 1-on-1 today. Full review to come later in the week, once you've gotten a chance to update this.
def self.find_recipe(params) | ||
@recipe_list.each do |recipe| | ||
if recipe.name == params | ||
return recipe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only works if the recipe being shown is in the most recent search results. If you open up two browser tabs and search for different things, you can only click on results from the last search.
The right thing to do here would be to send another request to Edamam, to get the details for that recipe. To do so you probably need something more distinct than just the recipe name - the URI might work nicely.
In general you should avoid using instance variables in class methods - these are basically global variables, and should only be used in very specific circumstances.
|
||
root 'recipes#search' | ||
get 'index', to: 'recipes#index', as: 'recipes_index' | ||
get ':recipe/show', to: 'recipes#show', as: 'recipes_show' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These paths aren't quit RESTful. Why not use resources [:index, :show]
here?
<% end %> | ||
<% end %> | ||
</ul> | ||
</class> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this </class>
tag?
API MuncherWhat We're Looking For
|
<% @recipes.each do |recipe| %> | ||
<li class="recipe_card"> | ||
<div class="name"><h2><%= recipe.name %></h2></div> | ||
<img src=<%= recipe.image %> class="thumbnail_photo"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Use image_tag
and make the image a hyperlink. It's human nature to want to click on the link.
API Muncher
Congratulations! You're submitting your assignment!
Comprehension Questions
lib
? How would your project change if you needed to interact with more than one API (aka more than just the Edamam API)?