railstutorial.org

Michael Hartl's Rails 3 Tutorial: Problem with has_password? method in Chapter 7

时光毁灭记忆、已成空白 提交于 2019-12-08 08:03:59
问题 This has been kicking my butt all morning. Right now, I'm just beginning Chapter 7.2.4 of Michael Hartl's excellent Ruby on Rails 3 Tutorial , and I'm running into some issues. The section begins with a quick check of the has_password? method, in the Rails console sandbox. Here's what I've typed in: ruby-1.9.2-p180 :001 > User => User(id: integer, name: string, email: string, created_at: datetime, updated updated_at: datetime, encrypted_password: string, salt: string) ruby-1.9.2-p180 :002 >

Rspec error, “undefined method 'downcase' for nil:NilClass”

浪子不回头ぞ 提交于 2019-12-08 07:52:28
问题 I keep getting this error when running my Rspec test and can't figure out why. I'm pretty new to Rails (and programming in general) so any direction or help would be much appreciated! EDIT: Here is a link to the repo, if anyone would like to sift through it and/or replicate the error. https://github.com/FluxAnimus/sample_app/tree/sign-up Failures: 1) User pages profile page Failure/Error: before { visit user_path(user) } ActionView::Template::Error: undefined method `downcase' for nil

Capybara::ElementNotFound: Unable to find field “Email” Railstutorial(chapter 9)

我的梦境 提交于 2019-12-08 05:30:32
问题 I am following Railstutorial (chapter 9) The test for" delete links " is passed for first time but from the next time it starts giving some kind of errors like: Failures: 1) User pages index delete links as an admin user Failure/Error: sign_in admin Capybara::ElementNotFound: Unable to find field "Email" # ./spec/support/utilities.rb:20:in `sign_in' # ./spec/requests/user_pages_spec.rb:38:in `block (5 levels) in <top (required)>' 2) User pages index delete links as an admin user Failure/Error

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

眉间皱痕 提交于 2019-12-07 06:57:18
问题 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

Proper s3 permissions for users uploading image files with carrierwave

ぐ巨炮叔叔 提交于 2019-12-07 06:00:57
问题 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

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

痴心易碎 提交于 2019-12-07 03:11:43
问题 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

Ruby Guard questions - 'Please install the sqlite3 adapter' - railstutorial.org

徘徊边缘 提交于 2019-12-06 23:33:41
问题 I am following along the Ruby on Rails Tutorial and have gotten somewhat confused in the testing section, in particular - 3.6.2 - Automated tests with Guard As per the tutorial's instructions for deployment to Heroku, I've switched over to Postgresql and removed sqlite3 from my gemfile and did a bundle install to update. However, once I run bundle exec guard I receive the message: /Users/username/.rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.1.3/lib/bundler/rubygems_integration.rb:147:in

Why use match rather than get when routing in Rails?

拜拜、爱过 提交于 2019-12-06 20:39:18
问题 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 =

rake aborted! Gem::LoadError: Specified 'postgresql' for database adapter

余生颓废 提交于 2019-12-06 17:32:15
问题 I'm new to Rails. Everything was OK till I change my Gemfile to be able to use heroku. I have pg in my Gemfile but I still get this error while running bundle exec rake test I cannot use rails console either. rake aborted! Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). /home/rihanna/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record

Rails validation error messages displays the error messages and array

我是研究僧i 提交于 2019-12-06 14:08:20
问题 I am working through the Ruby-on-Rails3 Tutorial Chapter 8. I have created a form that a user submits to sign up to a site. The validations are set in the model. They have been tested and are working. The problem is that when I display the validation error messages doing the following: <% if @user.errors.any? %> <div id="error_explanation"> <h2> <%= pluralize(@user.errors.count, "error")%> prohibited this user from being saved: </h2> <p>There were problems with the following fields:</p> <ul>