-
Notifications
You must be signed in to change notification settings - Fork 0
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
[WIP][追加課題]タスクにメモ機能の追加 #22
base: master
Are you sure you want to change the base?
Conversation
|
||
create_table "tasks", force: :cascade do |t| | ||
t.text "content" | ||
t.integer "status", limit: 4 | ||
t.date "duedate" | ||
t.text "memo" |
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.
Rails側のマイグレーションファイルがないですが、どこに行きましたか...
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.
@@ -1 +1 @@ | |||
json.extract! @task, :id, :content, :status | |||
json.extract! @task, :id, :content, :status :memo |
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.
Ruby的に文法ミス
@@ -1,11 +1,23 @@ | |||
import React from "react"; | |||
import ReactDOM from "react-dom"; | |||
|
|||
export default class Task extends React.Component { | |||
handleUpdate(e) { | |||
e.preventDefault(); | |||
this.props.onTaskUpdate({task: {id: this.props.id, status: e.target.value}}); |
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.
onTaskUpdateってtaskにすべての属性を渡さなくていいんでしたっけ。どこが本体だったかな...
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.
takapi-todo-app/app/assets/javascripts/TaskApp.js
Lines 46 to 58 in efddbb4
taskUpdate(task) { | |
request | |
.patch(this.props.url + '/' + task.task.id) | |
.accept('application/json') | |
.send(task) | |
.end((err, res) => { | |
if (err || !res.ok) { | |
console.error(this.props.url, status, err.toString()); | |
} else { | |
this.setState({data: res.body}); | |
} | |
}); | |
} |
ここですね(下も同じ)
PATCHのエントリポイントが部分的な更新を取り扱えるはずだからOKそう
|
||
create_table "tasks", force: :cascade do |t| | ||
t.text "content" | ||
t.integer "status", limit: 4 | ||
t.date "duedate" | ||
t.text "memo" |
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.
|
@@ -7,9 +7,6 @@ | |||
require 'rspec/rails' | |||
# Add additional requires below this line. Rails is not loaded until this point! | |||
|
|||
# for sqlite3 use in memory | |||
load Rails.root.join('db/schema.rb') if ENV['CI'] |
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.
あるいはここの前に ActiveRecord::Base.establish_connection
するといいのかもしれない。ちょっと深追いできてないけど...
実装内容
動作
やりたいこと