詰まったとことか
http://railstutorial.jp/ にそって学習中に詰まったところのメモを残しておく。
1章
- Versionまわり
- Herokuに対応してないバージョン等ある
- $ rvm hogehogeでなんとか
2章
-
$ rails generate scaffold User name:string email:string
-
/Users/Hiroki/Documents/RoR/demo_app/config/environments/development.rb:1:in `': undefined method `configure' for # (NoMethodError)
- http://stackoverflow.com/questions/23388205/rails-generate-scaffold-error
- development.rb の1行目の修正
-
$ rails s
-
DEPRECATION WARNING: You didn't set config.secret_key_base. Read the upgrade documentation to learn more about this new config option. (called from service at /Users/Hiroki/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/webrick/httpserver.rb:138)
- http://takeg.hatenadiary.jp/entry/2014/10/24/015803
- secret_token.rbの作成
-
$ git push heroku master
-
NoMethodError: undefined method `configure' for #DemoApp::Application:0x007fa758b2f5f0remote: /tmp/build_3bd2a4b4e12a86d2d7e35e2dace3b754/config/environments/production.rb:1:in `’
- http://mocolab.com/?p=979
- production.rbの1行目の修正
- pushされるのはcommit後のものなので、修正 → commit → push しないとダメ…
-
NoMethodError: undefined method `dump_schema_after_migration=' for ActiveRecord::Base:Class
- http://mocolab.com/?p=979
- production.rb の最終行をコメントアウト
-
$ heroku run rake db:migrate
-
Running `rake db:migrate` attached to terminal... up, run.3476 Timeout awaiting dyno, see https://devcenter.heroku.com/articles/one-off-dynos#timeout-awaiting-process
- http://stackoverflow.com/questions/14892200/cant-heroku-run-rake-db-migrate-through-my-ap...
- $ heroku run:detached rake db:migrate に修正
3章
-
$ bundle install
-
Bundler could not find compatible versions for gem "sprockets-rails":
In snapshot (Gemfile.lock):
sprockets-rails (2.2.4)
In Gemfile:
rails (= 4.0.5) ruby depends on
sprockets-rails (~> 2.0.0) ruby
Runningbundle update
will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict. -
$ bundle updateをするといくつかgem install しろみたいなことを言われた
- 赤文字が消えるまでgem installしたらbundle installもできた
-
$ rails generate rspec:install
-
/Users/Hiroki/Documents/RoR/sample_app/config/environments/development.rb:1:in
<top (required)>': undefined method
configure' for #SampleApp::Application:0x007f8698ca0de8 (NoMethodError)- development.rb の一行目の修正(2章と同様)
-
$ bundle exec rspec spec/requests/static_pages_spec.rb
-
/Users/Hiroki/Documents/RoR/sample_app/config/environments/test.rb:1:in
<top (required)>': undefined method
configure' for #SampleApp::Application:0x007fec45018798 (NoMethodError)- config/environments/test.rbの一行目修正(いつもの)
4章
とくになし
5章
とくになし
6章
とくになし
7章
- http://localhost:3000/users/1 にアクセスしたとき
cannot load such file -- bcrypt
- railsを再起動する
8章
- とくになし