railstutorial.org

Accessing session in integration test

六月ゝ 毕业季﹏ 提交于 2020-08-08 12:25:06
问题 I'm a Rails beginner working through Michael Hartl's Rails Tutorial and am receiving an error I have no idea how to fix. For reference, this is for implementing the changes in listing 9.24 (https://www.railstutorial.org/book/advanced_login). I skipped chapter 9 (since it is supposedly optional) but in Chapter 10 it asks to include the changes made in listing 9.24 so I did and my tests are still failing. This is the error I am receiving when I run rails test Error: UsersEditTest#test

Accessing session in integration test

不羁岁月 提交于 2020-08-08 12:24:23
问题 I'm a Rails beginner working through Michael Hartl's Rails Tutorial and am receiving an error I have no idea how to fix. For reference, this is for implementing the changes in listing 9.24 (https://www.railstutorial.org/book/advanced_login). I skipped chapter 9 (since it is supposedly optional) but in Chapter 10 it asks to include the changes made in listing 9.24 so I did and my tests are still failing. This is the error I am receiving when I run rails test Error: UsersEditTest#test

undefined method `[]' for nil:NilClass railstutorial.org 8.20 >

余生长醉 提交于 2020-05-29 08:57:21
问题 I'm following the rails-tutorials from Michael Hartl, it's really fun ! but i'm having troubles from upon listing 8.20 and so on. Cause i guessed i had made a type-o i erased the app and started from scratch again.. The best way to learn is repeat right ? Well.. also on the second build i got the same error. > NoMethodError in SessionsController#create undefined method `[]' for nil:NilClass Extracted source (around line #7): 6 def create 7 user = User.find_by(email: params[:session][:email]

rails tutorial expected css title with text to return something

好久不见. 提交于 2020-01-24 01:24:09
问题 I am working through the RoR tutorial at ruby.railstutorial.org and am currently on chapter 4. The tests aren't validating and I have no idea why. Top part of my spec file looks like this. The other methods all look identical to Help: describe "StaticPages" do let(:page_title) {"Ruby on Rails Tutorial Sample App"} let(:h1_test) {"should have the h1"} let(:title_test) {"should have the title"} describe "Home page" do |title_test, h1_test| it "#{h1_test} 'Sample App'" do visit '/static_pages

RailsTutorial Ch. 10: How do I test that only activated users are viewable to others?

蹲街弑〆低调 提交于 2020-01-23 17:27:08
问题 Currently, my Rails app only displays activated user accounts in the search results. It also only allows people to navigate to a profile page if that profile has been activated. To do these things, users_controller.rb is configured like this: def index @users = User.where(activated: true).paginate(page: params[:page]) end def show @user = User.find(params[:id]) redirect_to root_url and return unless @user.activated? end I am wondering how to use an integration test to check this behavior. My

SQLite3::SQLException: duplicate column name while migrating

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-22 16:11:47
问题 I am currently following the Ruby on Rails Tutorial and I am at https://www.railstutorial.org/book/updating_and_deleting_users#sec-administrative_users Every time I run bundle exec rake db:migrate I get the following error: SQLite3::SQLException: duplicate column name: remember_digest: ALTER TABLE "users" ADD "remember_digest" varchar/home/mclacs14/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/sqlite3-1.3.9/lib/sqlite3/database.rb:91:in `initialize' 回答1: try migrating your DB to

SQLite3::SQLException: duplicate column name while migrating

回眸只為那壹抹淺笑 提交于 2020-01-22 16:11:33
问题 I am currently following the Ruby on Rails Tutorial and I am at https://www.railstutorial.org/book/updating_and_deleting_users#sec-administrative_users Every time I run bundle exec rake db:migrate I get the following error: SQLite3::SQLException: duplicate column name: remember_digest: ALTER TABLE "users" ADD "remember_digest" varchar/home/mclacs14/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/sqlite3-1.3.9/lib/sqlite3/database.rb:91:in `initialize' 回答1: try migrating your DB to

Intalling the PostgreSQL gem pq for Heroku

为君一笑 提交于 2020-01-14 05:26:10
问题 First question here, but I want to thank you very much now, because stackoverflow helped me almost 15 times just in the first chapter of michael hartl tut. Now I'm trying to install PostgreSQL (pg gem) with this command: ` group :production do gem 'pg', '0.15.1' gem 'rails_12factor', '0.0.2' end` but it shows an ERROR -bash: group: command not found Then I tried to install directly (?) the gem with gem install pg But it shows another ERROR `Fetching: pg-0.17.1.gem (100%) Building native

Rails 4.2.0.beta2 - Can't connect to LocalHost?

半城伤御伤魂 提交于 2020-01-13 10:29:16
问题 I installed Rails 4.2.0.beta2 per the instructions in RailsTutorial.org 3rd Edition (the one that just came out). I'm not using the cloudIDE and am instead using Ubuntu Trusty 32 via Vagrant on a Windows 7 host with RVM. Did rails _4.2.0.beta2_ new hello_app and then pasted in his gemfile sample. After that, I ran: $ bundle install $ rails s Server starts fine, however when I try to connect to localhost:3000 I get "Server Not Found" Weirder still, I have a couple other Rails starter projects

Rails broken - bundle not working - ovirt-engine-sdk - ERROR: Failed to build gem native extension. Cloud9 AWS

自古美人都是妖i 提交于 2020-01-12 06:16:05
问题 I am working through the Ruby on Rails Tutorial (Rails5) by Michael Hartl in the AWS Cloud9 environment. I'm finishing chapter 11 now. (new to programming as well) It appears I have broken something related to the Rails (or Ruby) system. I am no longer able to start the Rails server, test or console. The error message I get usually starts with this, which I have not had any luck finding much information on here or via Google. ovirt-engine-sdk -v '4.2.3' /usr/local/rvm/gems/ruby-2.4.1/gems