Specs:
-
Using Ruby on Rails for the project
- Yup.
-
Include at least one has_many relationship (x has_many y; e.g. User has_many Recipes)
- A user has many vehicles.
-
Include at least one belongs_to relationship (x belongs_to y; e.g. Post belongs_to User)
- A vehicle belongs to a user.
-
Include at least two has_many through relationships (x has_many y through z; e.g. Recipe has_many Items through Ingredients)
- A user has many trips through vehicles, a trip has many legs through trip_legs.
-
Include at least one many-to-many relationship (x has_many y through z, y has_many x through z; e.g. Recipe has_many Items through Ingredients, Item has_many Recipes through Ingredients)
- The `trip_leg.rb` join table in the app/models directory fulfills the requirements of this 'z' variable.
-
The "through" part of the has_many through includes at least one user submittable attribute, that is to say, some attribute other than its foreign keys that can be submitted by the app's user (attribute_name e.g. ingredients.quantity)
- A user has many vehicles through trips; and a user can modify attributes of both trips (such as start & end locations) as well as vehicles, e.g. miles per gallon & name.
-
Include reasonable validations for simple model objects (list of model objects with validations e.g. User, Recipe, Ingredient, Item)
- A user must have a unique username & email address...vehicles must hav miles per gallon expressed as integers.
-
Include a class level ActiveRecord scope method (model object & class method name and URL to see the working feature e.g. User.most_recipes URL: /users/most_recipes)
- This requirement can be found in app/models/vehicle.rb and is used to find the current user's vehicle with the highest miles-per-gallon rating:
scope :highest_mpg, -> {order("miles_per_gallon DESC").first}
- Include signup (how e.g. Devise)
- app/views/users/new.html.erb.
- Include login (how e.g. Devise)
- app/views/sessions/new.html.erb
- Include logout (how e.g. Devise)
- app/views/layouts/convoyapp.html.erb
- Include third party signup/login (how e.g. Devise/OmniAuth)
- app/views/sessions/new.html.erb
- Include nested resource show or index (URL e.g. users/2/recipes)
- A user can navigate in the browser to "/users/1/vehicles/1" because vehicles are nested under users in ./config/routes:
resources :users do
resources :vehicles
end
- Include nested resource "new" form (URL e.g. recipes/1/ingredients/new)
- A new vehicle can be created, and vehicles are nested within users as described above.
- Include form display of validation errors (form URL e.g. /recipes/new)
Confirm:
- The application is pretty DRY
- Limited logic in controllers
- Views use helper methods if appropriate
- Views use partials if appropriate