Skip to content

Commit

Permalink
質問を、回答ボタンで反映できるようになりました。
Browse files Browse the repository at this point in the history
  • Loading branch information
kousukeuo committed Oct 24, 2018
1 parent a82e085 commit 71e8188
Show file tree
Hide file tree
Showing 4 changed files with 269 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/javascript/packs/hello_vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ document.addEventListener('DOMContentLoaded', () => {
axios.get(`api/questions/${id}`)
.then(res => {
this.question.push(res.data.title);
this.addAnswerToNote();
});
setTimeout(this.addAnswerToNote,500);

}
}
})
Expand Down
2 changes: 1 addition & 1 deletion app/views/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
<textarea v-model="answer" class="form-control" id="exampleFormControlTextarea1" rows="12"></textarea>
</div>
<div class="form-group">
<button @click="hoge(1)" class="btn btn-primary btn-lg btn-block">回答</button>
<button @click='hoge(1)' class="btn btn-primary btn-lg btn-block">回答</button>

</div>
<div class="card">
Expand Down
262 changes: 262 additions & 0 deletions log/development.log
Original file line number Diff line number Diff line change
Expand Up @@ -4190,3 +4190,265 @@ Processing by HomeController#index as HTML
Completed 200 OK in 150ms (Views: 136.9ms | ActiveRecord: 0.0ms)


Started GET "/api/questions/1" for 172.19.0.1 at 2018-10-19 08:48:23 +0000
Processing by Api::QuestionsController#show as HTML
Parameters: {"id"=>"1"}
Rendering api/questions/show.json.jbuilder
Rendered api/questions/show.json.jbuilder (0.6ms)
Completed 200 OK in 18ms (Views: 16.7ms | ActiveRecord: 0.0ms)


Started GET "/api/questions/1" for 172.19.0.1 at 2018-10-19 08:49:04 +0000
Processing by Api::QuestionsController#show as HTML
Parameters: {"id"=>"1"}
Rendering api/questions/show.json.jbuilder
Rendered api/questions/show.json.jbuilder (0.5ms)
Completed 200 OK in 19ms (Views: 18.0ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.19.0.1 at 2018-10-22 00:10:39 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (28.5ms)
Completed 200 OK in 376ms (Views: 335.2ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 01:54:44 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (11.1ms)
Started GET "/" for 172.20.0.1 at 2018-10-23 01:54:48 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (4.9ms)
Completed 200 OK in 23706ms (Views: 23724.2ms | ActiveRecord: 0.0ms)


Completed 200 OK in 22004ms (Views: 22027.1ms | ActiveRecord: 0.0ms)


Started GET "/api/questions/1" for 172.20.0.1 at 2018-10-23 01:55:15 +0000
Processing by Api::QuestionsController#show as HTML
Parameters: {"id"=>"1"}
Rendering api/questions/show.json.jbuilder
Rendered api/questions/show.json.jbuilder (8.1ms)
Completed 200 OK in 27ms (Views: 26.7ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 01:57:01 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (4.3ms)
Completed 200 OK in 176ms (Views: 157.1ms | ActiveRecord: 0.0ms)


Started GET "/api/questions/1" for 172.20.0.1 at 2018-10-23 01:57:07 +0000
Processing by Api::QuestionsController#show as HTML
Parameters: {"id"=>"1"}
Rendering api/questions/show.json.jbuilder
Rendered api/questions/show.json.jbuilder (0.5ms)
Completed 200 OK in 14ms (Views: 13.4ms | ActiveRecord: 0.0ms)


Started GET "/api/questions/1" for 172.20.0.1 at 2018-10-23 01:57:10 +0000
Processing by Api::QuestionsController#show as HTML
Parameters: {"id"=>"1"}
Rendering api/questions/show.json.jbuilder
Rendered api/questions/show.json.jbuilder (0.6ms)
Completed 200 OK in 19ms (Views: 18.3ms | ActiveRecord: 0.0ms)


Started GET "/api/questions/1" for 172.20.0.1 at 2018-10-23 01:57:11 +0000
Processing by Api::QuestionsController#show as HTML
Parameters: {"id"=>"1"}
Rendering api/questions/show.json.jbuilder
Rendered api/questions/show.json.jbuilder (0.5ms)
Completed 200 OK in 21ms (Views: 20.0ms | ActiveRecord: 0.0ms)


Started GET "/api/questions/1" for 172.20.0.1 at 2018-10-23 01:57:13 +0000
Processing by Api::QuestionsController#show as HTML
Parameters: {"id"=>"1"}
Rendering api/questions/show.json.jbuilder
Rendered api/questions/show.json.jbuilder (0.5ms)
Completed 200 OK in 18ms (Views: 17.3ms | ActiveRecord: 0.0ms)


Started GET "/api/questions/1" for 172.20.0.1 at 2018-10-23 01:57:15 +0000
Processing by Api::QuestionsController#show as HTML
Parameters: {"id"=>"1"}
Rendering api/questions/show.json.jbuilder
Rendered api/questions/show.json.jbuilder (0.5ms)
Completed 200 OK in 18ms (Views: 17.7ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 01:57:16 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (4.5ms)
Completed 200 OK in 179ms (Views: 163.7ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 01:57:54 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (6.0ms)
Completed 200 OK in 173ms (Views: 155.8ms | ActiveRecord: 0.0ms)


Started GET "/api/questions/1" for 172.20.0.1 at 2018-10-23 01:57:56 +0000
Processing by Api::QuestionsController#show as HTML
Parameters: {"id"=>"1"}
Rendering api/questions/show.json.jbuilder
Rendered api/questions/show.json.jbuilder (0.4ms)
Completed 200 OK in 14ms (Views: 12.9ms | ActiveRecord: 0.0ms)


Started GET "/api/questions/1" for 172.20.0.1 at 2018-10-23 01:57:58 +0000
Processing by Api::QuestionsController#show as HTML
Parameters: {"id"=>"1"}
Rendering api/questions/show.json.jbuilder
Rendered api/questions/show.json.jbuilder (0.5ms)
Completed 200 OK in 13ms (Views: 12.7ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 01:58:10 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (6.1ms)
Completed 200 OK in 196ms (Views: 178.6ms | ActiveRecord: 0.0ms)


Started GET "/api/questions/5" for 172.20.0.1 at 2018-10-23 01:58:12 +0000
Processing by Api::QuestionsController#show as HTML
Parameters: {"id"=>"5"}
Rendering api/questions/show.json.jbuilder
Rendered api/questions/show.json.jbuilder (0.6ms)
Completed 200 OK in 23ms (Views: 22.9ms | ActiveRecord: 0.0ms)


Started GET "/api/questions/5" for 172.20.0.1 at 2018-10-23 01:58:14 +0000
Processing by Api::QuestionsController#show as HTML
Parameters: {"id"=>"5"}
Rendering api/questions/show.json.jbuilder
Rendered api/questions/show.json.jbuilder (0.6ms)
Completed 200 OK in 24ms (Views: 23.6ms | ActiveRecord: 0.0ms)


Started GET "/api/questions/5" for 172.20.0.1 at 2018-10-23 01:58:17 +0000
Processing by Api::QuestionsController#show as HTML
Parameters: {"id"=>"5"}
Rendering api/questions/show.json.jbuilder
Rendered api/questions/show.json.jbuilder (0.6ms)
Completed 200 OK in 17ms (Views: 16.5ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 01:58:25 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (192.4ms)
Completed 500 Internal Server Error in 244ms (ActiveRecord: 0.0ms)



ActionView::Template::Error (undefined local variable or method `unko' for #<#<Class:0x0000557ffafee640>:0x00007f133ed11b10>):
122: <textarea v-model="answer" class="form-control" id="exampleFormControlTextarea1" rows="12"></textarea>
123: </div>
124: <div class="form-group">
125: <button @click="hoge(<%= unko %>)" class="btn btn-primary btn-lg btn-block">回答</button>
126:
127: </div>
128: <div class="card">

app/views/home/index.html.erb:125:in `_app_views_home_index_html_erb___4244470194373360381_69860317500040'
Started GET "/" for 172.20.0.1 at 2018-10-23 01:59:23 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (4.3ms)
Completed 200 OK in 166ms (Views: 152.5ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 02:01:32 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (5.8ms)
Completed 200 OK in 202ms (Views: 183.7ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 02:01:39 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (6.2ms)
Completed 200 OK in 196ms (Views: 178.0ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 02:01:40 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (6.5ms)
Completed 200 OK in 161ms (Views: 149.6ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 02:01:41 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (6.3ms)
Completed 200 OK in 172ms (Views: 157.8ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 02:01:43 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (4.3ms)
Completed 200 OK in 146ms (Views: 136.0ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 02:02:01 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (4.7ms)
Completed 200 OK in 158ms (Views: 145.0ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 02:02:02 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (4.7ms)
Completed 200 OK in 171ms (Views: 157.3ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 02:02:02 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (5.5ms)
Completed 200 OK in 175ms (Views: 161.4ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 02:03:03 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (5.5ms)
Completed 200 OK in 202ms (Views: 186.2ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 02:12:31 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (4.8ms)
Completed 200 OK in 168ms (Views: 152.3ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-23 14:20:02 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (37.9ms)
Completed 200 OK in 386ms (Views: 359.7ms | ActiveRecord: 0.0ms)


Started GET "/" for 172.20.0.1 at 2018-10-24 01:26:36 +0000
Processing by HomeController#index as HTML
Rendering home/index.html.erb within layouts/application
Rendered home/index.html.erb within layouts/application (22.6ms)
Completed 200 OK in 321ms (Views: 289.4ms | ActiveRecord: 0.0ms)


8 changes: 4 additions & 4 deletions public/packs/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"application.js": "/packs/application-b80295cdd2b19c8c0752.js",
"application.js.map": "/packs/application-b80295cdd2b19c8c0752.js.map",
"hello_vue.js": "/packs/hello_vue-82d6c1ecdfb0d7ea098e.js",
"hello_vue.js.map": "/packs/hello_vue-82d6c1ecdfb0d7ea098e.js.map"
"application.js": "/packs/application-51aaa2941a4fa1720717.js",
"application.js.map": "/packs/application-51aaa2941a4fa1720717.js.map",
"hello_vue.js": "/packs/hello_vue-0c2e171c2e171daa7339.js",
"hello_vue.js.map": "/packs/hello_vue-0c2e171c2e171daa7339.js.map"
}

0 comments on commit 71e8188

Please sign in to comment.