Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6889625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:10:47+00:00 2026-05-27T06:10:47+00:00

I am trying to follow a tutorial on TDD with RSpec that contains the

  • 0

I am trying to follow a tutorial on TDD with RSpec that contains the following line:

it 'must have a first_name' do
  p = Person.new
  p.should_not be_valid
  p.errors.on(:first_name).should_not be_nil
end

However I receive the following message in my test:

undefined method `on’ for #ActiveModel::Errors:0x007fde0c3eceb0>

What is the correct way to write the code above.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:10:48+00:00Added an answer on May 27, 2026 at 6:10 am

    The correct function is errors_on. So that line should be

    p.errors_on(:first_name).should_not be_nil
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to follow this tutorial: http://jqueryfordesigners.com/fixed-floating-elements/ . The problem is that whenever the
I'm trying to follow this tutorial to made a Word doc template that i
I'm trying to follow the Sequelize tutorial on their website . I have reached
I am trying to follow TDD on Rails Tutorial which is available online here
I'm trying to follow Sun's JDBC tutorial at http://java.sun.com/docs/books/tutorial/jdbc/basics/connecting.html It gives the following example
I am trying to follow this tutorial and I get the following error which
I am trying to follow this tutorial: http://playcontrol.net/ewing/jibberjabber/opengl_vertex_buffer_object.html And I have received this error:
I'm trying to follow this tutorial - http://www.dotnetcurry.com/ShowArticle.aspx?ID=231&AspxAutoDetectCookieSupport=1 I have both the vsdoc file
I'm trying to follow the tutorial to use jQuery UI plugin. I'm new to
Im trying to follow a tutorial that is using SBJsonParser to get twitter feeds,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.