Skip to content
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

Submitting Coder School Assignment 1 #1

Open
thminhVN opened this issue Mar 19, 2016 · 2 comments
Open

Submitting Coder School Assignment 1 #1

thminhVN opened this issue Mar 19, 2016 · 2 comments

Comments

@thminhVN
Copy link
Owner

Here is my completed assignment 1. Sorry for late submission.
/cc @coderschoolreview

@harley
Copy link

harley commented Mar 22, 2016

Hi @thminhVN -- good job 👍 The goal of this homework is to understand routes (RESTful and custom), use MVC correctly for simple pages, generate simple test data, use validations, use ActiveRecord for filtering, sorting and association.

Great things:

  • Choosing a nice template for your restaurant website. It's good to see that you leave the credit in.
  • Use bootstrap 3 instead of bootstrap 4 gem because the template uses v3. That's a good decision.
  • Use of ajax
  • Good and consistent use of font-awesome

Suggestions:

  • Add validations to your model, such as for name for Section, name, price, section_id for MenuItem
  • More use of association: you can add has_many :menu_items for Section.
  • Clean up your config/routes.rb file: there are many used lines that were added by rails generator.
  • Interesting use of OrderController. In general you'll find that sticking to the convention of plural OrdersController is easier. Side note: there is Singular Resource which is similar to what you do but I recommend NOT using it. Try to stick with the plural form. In your code, you can also use nested resources like below
resources :menu_items do
  resources :orders
end

That way in your OrdersController, you have params[:menu_id] when someone submit a POST to /menu_items/123/orders to create an order for menu item 123.

Overall, it's good to see that your code is relatively clean. In your free time, I recommend checking out the Ruby style guide. If interested in more stuff like that, the Rails style guide includes good ideas as well. I hope you can start homework earlier next time order to have time for some optional features as well.

@thminhVN
Copy link
Owner Author

@harley Thanks for your review. I will read Ruby style guide and try to improve later.

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

No branches or pull requests

2 participants