railstutorial.org

Possible bug in Rails 4 Tutorial, section 9.6, exercise 1

限于喜欢 提交于 2019-12-23 00:29:18
问题 I'm working through the Rails 4 version of Michael Hartl's Rails Tutorial and having trouble with section 9.6 exercise 1 (Listing 9.49). It looks like the test in the tutorial passes for the wrong reason. Before the PATCH request, user.admin? is false by default; after the PATCH request user.admin? is still false (thus passing the test) because the PATCH request is not getting to the UsersController#update method. Here's my code: spec/requests/user_pages_spec.rb (other tests removed to

RailsTutorial 3.2 Ch 11 - PostgreSQL syntax error breaks the status feed

拟墨画扇 提交于 2019-12-22 14:03:38
问题 I'm in Section 11.3.1 of the Rails Tutorial, and all tests were passing prior to this. Afterward, the home page (which has the micropost feed) breaks with this error: PG::Error: ERROR: invalid input syntax for integer: "98, 1" LINE 1: ...CT COUNT(*) FROM "microposts" WHERE (user_id IN ('98, 1') O... ^ : SELECT COUNT(*) FROM "microposts" WHERE (user_id IN ('98, 1') OR user_id = 101) And several of the tests fail with a similar issue. Here's the first one: 1) Authentication authorization as

Button doesn't update in Ajax - Rails Tutorial 3 at §12.2.5

天大地大妈咪最大 提交于 2019-12-22 03:46:33
问题 I'm going through the Rails Tutorial by Michael Hartl and hit a small snag at §12.2.5 where we're supposed to create a working button with Ajax. I know the code is correct (I wound up copying it directly from the book and retyping it three times) and I'm green. But it doesn't actually work! Through this part of the tutorial we are changing a regular form submit button to work with Ajax so that the entire page doesn't "refresh" (really, redirect to the same page) and instead just the button

railstutorial where is debug information coming from

筅森魡賤 提交于 2019-12-21 07:37:45
问题 In chapter 7 I'm getting the following output with --- !ruby/hash-with-ivars:ActionController::Parameters elements: controller: static_pages action: home ivars: :@permitted: false could someone explain where the hash-with-ivars is coming from and what ivars: :@permitted: false means? 回答1: Interesting question! I searched all library sources of a rails project for 'hash-with-ivars' and only a single place came up: the psych ruby library for (de-)serializing arbitrary objects to and from YAML.

Rails Tutorial: nokogiri-1.5.2 error on bundle install

坚强是说给别人听的谎言 提交于 2019-12-20 10:33:45
问题 After working through the RVM setup, rspec and guard sections of chapter 3 of the Ruby on Rails Tutorial, whenever I run bundle install I get the following error dump: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from extconf.rb:5:in `<main>' Gem files

railstutorial.org, Chapter 6. unknown attribute: password

一笑奈何 提交于 2019-12-19 03:14:15
问题 I have finished Chapter 6 of railstutorial but all my User model specs have started failing soon after I added password & password_confirmation with the following errors: Failures: 1) User Failure/Error: @user = User.new(name: "Example User", email: "user@example.com", ActiveRecord::UnknownAttributeError: unknown attribute: password # ./spec/models/user_spec.rb:17:in `new' # ./spec/models/user_spec.rb:17:in `block (2 levels) in <top (required)>' 2) User Failure/Error: @user = User.new(name:

railstutorial.org, Chapter 6. unknown attribute: password

≯℡__Kan透↙ 提交于 2019-12-19 03:14:08
问题 I have finished Chapter 6 of railstutorial but all my User model specs have started failing soon after I added password & password_confirmation with the following errors: Failures: 1) User Failure/Error: @user = User.new(name: "Example User", email: "user@example.com", ActiveRecord::UnknownAttributeError: unknown attribute: password # ./spec/models/user_spec.rb:17:in `new' # ./spec/models/user_spec.rb:17:in `block (2 levels) in <top (required)>' 2) User Failure/Error: @user = User.new(name:

Ruby on rails and Node.js

混江龙づ霸主 提交于 2019-12-18 10:33:30
问题 I am wondering how to integrate node.js on a rails app (for learning purpose). Based on Michael Hartl tutorial (http://railstutorial.org/) I realized a basic twitter clone with rails and want to get user microposts in real-time without the use of comet or juggernaut. (the application is hosted on heroku) For the moment, I only see example with node.js frameworks (http://howtonode.org/grasshopper-shoutbox) but nothing merged with a ruby on rails app. I would be very thankful if someone knows a

Rails - NoMethodError: undefined method `configure' for #<FirstApp

浪尽此生 提交于 2019-12-18 07:16:09
问题 I am working on a tutorial, I am trying to do step 1.4.2. I have tried several things but none seem to work when I searched the web "NoMethodError: undefined method `configure'". I looked at all the links and several similar searches that came up but none worked. In the book it says to do this: # This should only be used if your Heroku deploy fails without it. $ rake assets:precompile $ git add . $ git commit -m "Add precompiled assets for Heroku" but it has not worked or i have not gotten it

Excon::Errors::Forbidden (Expected(200) <=> Actual(403 Forbidden)

余生长醉 提交于 2019-12-17 22:37:25
问题 When I try to upload a picture to a "Car" object I'm denied access to S3. But the site images that are in the assets folder have displayed just fine since I added S3. The specific error that I get is this: 2015-02-17T14:40:48.459629+00:00 app[web.1]: Excon::Errors::Forbidden (Expected(200) <=> Actual(403 Forbidden) 2015-02-17T14:40:48.459630+00:00 app[web.1]: excon.error.response 2015-02-17T14:40:48.459635+00:00 app[web.1]: "Connection" => "close" 2015-02-17T14:40:48.459637+00:00 app[web.1]: