railstutorial.org

RailsTutorial Ch 9: signin_path is undefined local variable? Email already taken?

我的未来我决定 提交于 2019-12-06 13:39:14
问题 I'm going through RailsTutorial and I'm stuck at chapter 9.3. Rspec keeps giving me these errors when I try to run a suite test at the end of 9.3: /Users/shaan/Sites/sample_app/spec/support/utilities.rb:15:in `sign_in': undefined local variable or method `signin_path' for #<Class:0x107759358> (NameError) /Library/Ruby/Gems/1.8/gems/activerecord-3.2.3/lib/active_record/validations.rb:56:in `save!': Validation failed: Email has already been taken (ActiveRecord::RecordInvalid) First I got the

teaching myself rails deploying first app to heroku -failure to upload - sqlite3 and postgre glitch

拥有回忆 提交于 2019-12-06 08:16:10
Im teaching myself rails. Im a programmer but not a web programmer. Im going through Michael Hartl's book here It mentions that its a good idea to start deploying your app right from the beginning. I agree. So I got an account on Heroku and went through ther setup etc. Then created my 1st app, git and the works. Then followed all the instructions on Heroku's site. Finally I came to pushing my app up to Heroku using this command: git push heroku master The book says that there could be problems at this stage because the app on my machine is using sqlite3 while Heroku wants postgresql. The book

Testing views with will_paginate Gem using Capybara/Rspec

无人久伴 提交于 2019-12-06 06:17:16
Doing Michael Hartl's Rails Tutorial, on chapter 10, section 5, exercise 2 . I am - very simply - trying to write tests to ensure that a pagination div appears on a couple pages using the will_paginate gem (this seems to be Hartl's preferred method of testing whether pagination works), but when I add the following code.. subject { page } . . . it { should have_selector('div.pagination') } ..it returns.. 1) UserPages profile page Failure/Error: it { should have_selector('div.pagination') } expected css "div.pagination" to return something This is especially odd because in this particular _spec

Hartl Rail Tutorial: Chapter 5, exercise 3

一世执手 提交于 2019-12-06 06:16:37
I'm trying to make sense of the last exercise in Chapter 5 of Hartl's Rails Tutorial but don't really understand it nor what it strives to do. My rationale: It speaks of "full_title helper", which refers to the code we placed in app/controllers/helpers/application_helper.rb: def full_title(page_title = '') base_title = "Ruby on Rails Tutorial Sample App" if page_title.empty? base_title else "#{page_title} | #{base_title}" end end The exercise is: 1) Include the above application_helper.rb file in the test_helper by adding the line "include ApplicationHelper" to /test/test_helper.rb 2) We can

Password Reset Test failing in M.Hartl's Ruby on Rails Tutorial (3rd edition), Chapter 10 (10.54)

徘徊边缘 提交于 2019-12-06 04:15:27
All my tests/assertions have passed as expected up until now. I'm pretty confident that the application itself is working fine, but I'm failing one assertion in this test. I'm a Rails rookie, but I know from other programming experiences that not resolving this now is likely leaving a gremlin to fester. Out of respect for SO members' time (and recognizing my Rails-novice state) I have done just about everything humanly possible to troubleshoot before asking this question, including: Restarted my local Rails server (multiple times). Looked at every other question here about tests failing in the

Proper s3 permissions for users uploading image files with carrierwave

泪湿孤枕 提交于 2019-12-05 10:27:40
At the end of Chapter 11 of The Rails Tutorial by Michael Hartl I successfully managed to enable user uploads to Amazons S3 service by creating a bucket, using IAM to set a user and granting the user an AmazonS3FullAccess policy. It feels dirty and very insecure to allow an unknown user on my website to have full access to a bucket for image upload on my website and I'm not sure if I should feel this way. I created a custom policy at http://awspolicygen.s3.amazonaws.com/policygen.html Which is the following: { "Version": "2012-10-17", "Statement": [ { "Sid": "Stmt1445501067518", "Action": [

How to keep rspec tests DRY with lots of “have_link”

99封情书 提交于 2019-12-05 09:47:47
I'm new to Ruby on Rails and I'm doing http://ruby.railstutorial.org right now. From what I understand the language is supposed to follow this DRY standard wery strictly but it's so WET when it comes to test driven development in this tutorial. For example it { should have_link('Users', href: users_path) } it { should have_link('Profile', href: user_path(user)) } it { should have_link('Settings', href: edit_user_path(user)) } it { should have_link('Sign out', href: signout_path) } Here we have lots of rows that almost looks the same. I'we tried this it "should have following links from this

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

允我心安 提交于 2019-12-05 09:39:45
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 I've been tinkering with that use Rails 4.0.3 and 4.1.6 and I'm able to connect to the server there

railstutorial.org gems/notiffany-0.1.1/lib/notiffany/notifier/tmux/client.rb:12:in `version': undefined method

自古美人都是妖i 提交于 2019-12-05 08:07:08
I'm following the Ruby on Rails tutorial at RailsTutorial.org and am on section 3.3.1 (/book/static_pages#cha-static_pages) for running 'rails test' for the first time. I'm using the Cloud9 IDE per the recommendation and as far as I can tell I have followed the script exactly. Everything has matched up to this point. I have also done some searches on the error and come up with comments about something called tmux but I'm not sufficiently experienced enough in Ruby on Rails or Cloud9 to be sure of what I'm doing. Someone also recommended doing 'bundle exec rake test' as an alternative but I get

Why use match rather than get when routing in Rails?

僤鯓⒐⒋嵵緔 提交于 2019-12-05 00:31:56
In the Ruby on Rails 3 tutorial, the code uses: match '/signup', :to => 'users#new' match '/signin', :to => 'sessions#new' match '/signout', :to => 'sessions#destroy' match '/contact', :to => 'pages#contact' match '/about', :to => 'pages#about' match '/help', :to => 'pages#help' rather than get '/signup', :to => 'users#new' get '/signin', :to => 'sessions#new' get '/signout', :to => 'sessions#destroy' get '/contact', :to => 'pages#contact' get '/about', :to => 'pages#about' get '/help', :to => 'pages#help' even though all the routes only want the HTTP GET verb. Why not use get (or :via => [