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 7871957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:04:01+00:00 2026-06-03T02:04:01+00:00

In my Rails 3.2 app, I have a signup form that includes a terms

  • 0

In my Rails 3.2 app, I have a signup form that includes a “terms and conditions” checkbox. The form looks something like this:

<%= form_for @user do |f| %>
  <!-- Error message stuff -->
  <%= f.text_field :email %>
  <!-- More fields... -->
  <%= text_field_tag :terms_and_conditions, false, "true" %>
<% end %>

To make sure the user checks that checkbox, I have the following code in my controller:

unless params[:terms_and_conditions] == "true"
  @user.errors[:base] << "You must check the 'Terms and Conditions' checkbox"
end

But when I call @user.save (or @user.valid?), it seems to clear out this error message. I know I could use @user.errors.empty? && @user.save, but I find it strange that the save method doesn’t care about the error message I just added. Is there a better and more elegant way to do this?

  • 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-06-03T02:04:03+00:00Added an answer on June 3, 2026 at 2:04 am

    Rails offers an acceptance validator. It’s perfect for your situation. See docs for further information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a Rails 3.1 app and have a signup form that was
So I have a Rails app (which in this case seems like it would
I have a ruby on rails app that has a signup page. Different pages
I am creating a rails app and have used this code in one of
I'm using the Simpleform gem for my rails app and I have a form
in my Rails app have this routes.rb: devise_for :admin namespace :admin do root :to
I am creating a Rails App (I'd like to know how to do this
I have this new Rails app. I installed Devise. I don't want people registering
I have this Rails app, with domain name abc.com . I am also having
Hey. So I have a Rails app that's getting deployed to a production machine

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.