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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:17:56+00:00 2026-06-08T14:17:56+00:00

I am getting started into ajax with ruby and my problem is that i

  • 0

I am getting started into ajax with ruby and my problem is that i cant get the error messages i could get when i submit the form via post with refresh

controller

class InvitesController < ApplicationController

    def request_invite
        render_404 unless request.xhr?

        @invitation = Invite.new(params[:invite])
        if @invitation.save
            @return = { :error => false, :response => "OK" }
        else
            @return = { :error => true, :response => "BAD" } 
        end
        render :json => ActiveSupport::JSON.encode( @return ) 
    end

end

so now i have custom errors but i would like to replace “BAD” with the actual errors that the form returns…

model

class Invite < ActiveRecord::Base

    validates :email, :presence => true, :uniqueness => true

    validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i

end

how could i do that?

  • 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-08T14:17:57+00:00Added an answer on June 8, 2026 at 2:17 pm

    Try something like this:

    @return = { :error => true, :response => @invitation.errors.full_messages.join(", ") }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just getting started developing for Android and I'm running into a weird problem.
I'm running into a small problem at the end of the Getting Started guide
I have the following html code: (that gets loaded via ajax into a div)
Just getting started with WF4. Ran into a problem with passing some text from
I'm just getting started with git and am running into a problem when attempting
ok so I'm just getting started in scala.. ran into a weird problem with
I just started getting into iPhone development. I have been mish-mashing tutorials and material
I've just started getting into Catalyst, and I've been finding it really helpful. One
I am just getting started with NHaml and ran into a snag. This is
I am just getting started couchdb and have been looking into writing couch apps.

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.