railstutorial.org

Global access to Rake DSL methods is deprecated

元气小坏坏 提交于 2019-12-17 15:13:15
问题 I am working through the Ruby on Rails 3 tutorial book and typed the following on the command line: rake db:migrate which produced the following warning. WARNING: Global access to Rake DSL methods is deprecated. Please Include ... Rake::DSL into classes and modules which use the Rake DSL methods. WARNING: DSL method DemoApp::Application#task called at /Users/imac/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks' I am not sure what

Getting a strange error on my routes, “missing required keys” rails 4

走远了吗. 提交于 2019-12-14 03:04:36
问题 So I am getting this error on my localhost:3000. I am making a gif posting blog app and I am trying to add an edit function to items that appear in my _feed_item.html.erb partial. I have posted the error below and a link to some source files in a gist. I believe the routes are ok, but the "missing required keys: [:id]" piece is the one aspect I don't understand. Not sure why this doesn't work as well as my delete function does. Some of this code is based on Hartl's rails tutorial. app/views

rails 3 tutorial: No route matches [GET] “/”

南楼画角 提交于 2019-12-13 23:53:02
问题 SO, Paid for the PDF a few hours ago, followed the instructions carefully but after starting up first_app I see this in localhost:3000: Routing Error No route matches [GET] "/" Haven't touched any code, just started up the server after doing "rails new first_app". From the command-line: 552 ~/Downloads/rails_projects/first_app>=> Booting WEBrick => Rails 3.1.0.rc6 application starting in production on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server Sprockets:

CSS railstutorial

[亡魂溺海] 提交于 2019-12-13 19:56:01
问题 I'm following Michael Hartl's Rails tutorial and having some trouble getting my layout to match his, even though the code looks to be exactly the same. Three things... The Gravatar in the h1 in the show.html.erb is too small. The user.name in the h1 in the show.html.erb is on two separate lines and too big. Lastly, the debug box in the application.html.erb at the bottom of the page doesn't seem to clear the footer. Instead of being 45px below the footer it is smack bam on top. custom.css.scss

Rails Tutorial (M.Hartl) 3rd Edition, Chapter 8, How to unlock a database by closing a rogue `rails console`?

不羁岁月 提交于 2019-12-13 07:37:40
问题 I am in chapter 8.4.1, after generating a migration I tried running: $ bundle exec rake db:migrate But was given the following error: rake aborted! StandardError: An error has occurred, this and all later migrations canceled: SQLite3::BusyException: database is locked: #followed by a long list of paths/filenames and line numbers... I know this is probably because I exited a terminal without properly exiting a rails console --sandbox session. But how do I find and close this rails console

Rails Tutorial: NoMethodError: undefined method `each' for nil:NilClass

孤街醉人 提交于 2019-12-13 06:08:21
问题 I'm incredibly new to ruby on rails, and very likely missing something easy. I've been following through Michael Hartl's tutorial book. Everything was fine last night when I stopped, but this morning I am hitting my head on a wall trying to figure out this error. I'm on Chapter 8: the test is listing 8.25. I thought I may have just made a typo, so I went back to where I started this morning and just copied the code straight from the tutorial. Still, when I run the test I get 1) Error:

bootstrap-sass gem breaking my rails 3.2.3 at step 5.1.2 in Hartl's rails tutorial

不打扰是莪最后的温柔 提交于 2019-12-13 05:52:48
问题 Everything up to this point has worked great, including upload to github and heroku, as well as using postgres for dev/test and prod/heroku. As soon as I add gem 'bootstrap-sass', '2.0.0' to my Gemfile and run bundle install (or bundle install --without assets ), spork, guard, and rails (and stand-alone passenger) all complain w/ the following: /var/lib/rails/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:74:in `require': cannot load such file -- bootstrap/sass

Rails Minitest integration test broken: Expected at least 1 element matching “div.pagination”, found 0

强颜欢笑 提交于 2019-12-13 05:27:11
问题 We are using Michael Hartl's Rails Tutorial as an inspiration to build a completely different RoR app. However, we stumbled upon an issue that may be of help to other people following the tutorial. Here is our user_index_test.rb file: test "index as admin including pagination and delete links" do log_in_as(@admin) get users_path assert_select 'div.pagination' first_page_of_users = User.paginate(page: 1) first_page_of_users.each do |user| assert_select 'a[href=?]', user_path(user), text: user

Rails tutorial 3.6, 'bin' is not recognized as an internal or external command

怎甘沉沦 提交于 2019-12-13 04:23:52
问题 I'm stuck at section 3.6 of railstutorial.org, specifically when I run > bin/rspec spec/ on my Windows 7 machine I get 'bin' is not recognized as an internal or external command. I have already typed > bundle --binstubs I don't have RVM on here. Should I install it? When I go cd bin and execute rspec, I get 'load': cannot load such file My gemfile: source 'https://rubygems.org' gem 'rails', '3.2.13' group :development, :test do gem 'sqlite3', '1.3.5' gem 'rspec-rails', '2.11.0' end # Gems

Michael Hartl Rails Tutorial - undefined method 'sign_in'

China☆狼群 提交于 2019-12-13 04:02:42
问题 I'm actually stuck on Chapter 9 in Michael Hartl Rails Tutorial : http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#sec-unsuccessful_edits When I run that command line : $ bundle exec rspec spec/requests/user_pages_spec.rb -e "edit page" I have that error : Failure/Error: sign_in user NoMethodError: undefined method 'sign_in' for #<RSpec::Core::ExampleGroupe::Nested_1::Nested_4::Nested_1:0x4e7a0b8> Issue come from this code in spec/requests/user_pages_spec.rb :