Skip to content

Conversation

@lmarianarp19
Copy link

@lmarianarp19 lmarianarp19 commented Sep 30, 2017

Task List

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe in your own words what the Model is doing in Rails The model is in charge of all the logic of the application.
Describe in your own words what the Controller is doing in Rails The controller has some methods in charge of giving the right respond to the links in the view.
Describe in your own words what the View is doing in Rails The view is what we are going to show to the client. It can show information store, links, etc.
What is the purpose of using strong params? (i.e. the params method in the controller) The params is a hash that store all the information at the app. If an user input some new information this will be store at the params and we can control this information using the params.
How are Rails migrations related to Rails models? The migrations are changes at the models.
Describe one area of Rails that are still unclear on For me it is not clear how to create methods at the controller other than the create, new, edit, update and destroy methods. Also I'm not sure how to create the correspond routes.

@Hamled
Copy link

Hamled commented Oct 6, 2017

Task List

What We're Looking For

Feature Feedback
Baseline
Appropriate Git Usage with no extraneous files checked in Mostly. You should break each of your git commits up into smaller pieces. There are also a few files checked in that we should ignore (log/development.log and db/development.sqlite3).

We can ignore these and related files by adding the following lines to your .gitignore file:
/log/
/db/*.sqlite3
Answered comprehension questions ✅ You mention not being clear about creating additional methods in the controller, but you have a mark method in this project. I think you're doing well with that, and you will learn more with RideShare Rails as well.
Successfully handles: Index, Show
Successfully handles: New, Create
Successfully handles: Edit, Update
Successfully handles: Destroy, Task Complete
Routes follow RESTful conventions
Uses named routes (like _path)
Overall Looks good! I think we could have also DRY'd up the view code by creating a _form.html.erb partial to hold the form_for code, since it is the same in both new.html.erb and edit.html.erb.

get '/tasks/:id/edit', to: 'tasks#edit', as: 'edit_task'
patch '/tasks/:id', to: 'tasks#update'
delete '/tasks/:id', to: 'tasks#destroy'
post '/tasks/:id/checkout', to: 'tasks#checkout', as: 'checkout_task'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we don't have a checkout method in TasksController so I think this route should probably be removed.

def create #Has access to user data, from the form
@task = Task.create(title: params[:task][:title], description: params[:task][:description], duedate: params[:task][:duedate], complete: false)
# task.save
redirect_to('/tasks')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally here we would use redirect_to tasks_path instead. It should work the same way as this line does, but is more flexible if we for some reason need to change the URL that maps to the tasks#index action.

<%= link_to "Añadir Tarea", new_task_path %>
</il>
<il>
<%= link_to "Todas las tareas", tasks_path %>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section of links to "Añadir Tarea" and "Todas las tareas" is repeated at the top of every view. We can DRY up this code by moving it into the app/views/layouts/application.html.erb layout template.

In this case we would put it above the line with <%= yield %> so that it appears above all of the content for a given page.

<% @tasks.each do |task| %>
<li>
<h3>
<% if task.complete %>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if statement can probably be DRY'd up somewhat.

The link_to that we're creating in both cases is identical except for the ID that it will have. Since that is the case we can probably use a ternary statement to figure out the correct ID and then write the link_to code once:

<%= link_to task.title, task_path(task.id), id: task.complete ? "Complete" : "NoComplete" %>

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