Skip to content

Conversation

@tingwong
Copy link

@tingwong tingwong commented Apr 1, 2017

Rails Zoo

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe in your own words the Rails request/response cycle for viewing an animals detail page When the user requests to view the animal's detail page, the browser sends a request to the router to GET the animals/:id page. This then gets mapped to the #show method in the controller which displays an animal with the id of the one selected. The display occurs in the view, so the controller calls the view, show.html.erb, the view (which includes the HTML) is then populated with the details of the requested animal and is sent back to the browser.
Describe one area of Rails that you gained more clarity on with this assignment I gained a little bit more clarity in the views, specifically show.html.erb. For the image link, I wanted to provide an if statement so that if no image link was available, the animal details page would be blank (rather than show a broken image link). I gained a bit more clarity, though not total clarity, on how you could write code alongside the HTML.
Is there a specific piece of code you'd like more feedback on? Yes , can you check the code for show.html.erb where I used the if statement to display the image? Can you comment specifically on how to wrap the code in either <%= ... %>, <% ... %> or simply leaving it out for the <img src= ... > line?
What is one aspect of this project that surprised you? I think I was surprised both at how much more I understood compared to our initial project, but also how much more I still didn't understand with basic relationships between the code. For example, to create an Animal, why would we also need to use Animal.new (in our def new) in addition to our Animal.create? I understand that we need a method that displays a form for our Animal, but am unsure as to why we need the initial Animal.new when .create can handle both the new instance and creation of the Animal.

Also, I'm unsure in the editing route,

get 'tasks/:id/edit', to: 'tasks#edit', as: 'edit_task'
patch 'tasks/:id', to: 'tasks#update'

How does the patch action know to post it to the right Animal.id? Specifically, where do we specify this in our code?
|

@PilgrimMemoirs
Copy link

PilgrimMemoirs commented Apr 6, 2017

Rails Zoo

What We're Looking For

Feature Feedback
Appropriate Git usage with no extraneous files checked in Well done
Answered comprehension questions Well Done
Naming conventions: controller is plural, model is singular Well done
Overall
Your if statement in your show.html.erb looks really good. It's best to only use the equal sign in the embedded ruby tags when you want to display something that is specifically within those tags. In this case, the lines with the if statment logic should not have the '='. If there was something you wanted to display , like the buttons or the the animals name - then use the '='. For the if statment logic, you dod not need the '.nil?' part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants