-
Notifications
You must be signed in to change notification settings - Fork 33
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
CK app #23
base: master
Are you sure you want to change the base?
CK app #23
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.
Looks good. There are a couple of rails specific things I noticed. I left your JS alone :P
FYI, this is a thing: http://edgeguides.rubyonrails.org/api_app.html
end | ||
|
||
def show | ||
@task = Task.find(params[:id]) |
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.
looks good. we might clean up lines 9, 23 & 33 with a before_action.
see: http://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html
|
||
def create | ||
@task = Task.new(task_params) | ||
if @task.valid? |
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.
.save!
will run validations in this case. you can save yourself a line here.
See: http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-save-21
|
||
def update | ||
@task = Task.find(params[:id]) | ||
@task.update(task_params) |
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.
.update!
calls .save!
See: See: http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-save-21
No description provided.