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

  • Home
  • SEARCH
  • 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 6193385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:06:37+00:00 2026-05-24T03:06:37+00:00

but how else??? My Model is handling the logic and data for a booking

  • 0

but how else???

My Model is handling the logic and data for a booking system that I’m writing that allows users to make recurring bookings of resources. I want to show a pop up letting the user know that there was an issue with a recurring booking (conflict for one of the resources on one of the days for instance), but to also allow them to continue with the booking anyway, i.e don’t just fail validation and rollback.

The logic is fine for this but what is the best way to call the pop up displaying conflicts if I cannot/should not call a controller method from the model that fires some AJAX?

Using Rails 3

Thank for the help

  • 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-24T03:06:39+00:00Added an answer on May 24, 2026 at 3:06 am

    I’d start by defining a method on the model which returns any conflicting events, e.g.:

    class Event
    
       def conflicts
          Event.where(...)
       end
    
    end
    

    Then, in your view you can iterate through any conflicts if there are, and display them on the page.

    If you want to do this before saving the event to the database, then you could add some javascript to the page to POST the event data via AJAX, along with a ‘preview’ param, and have the controller return a JSON representation of the event without saving it. Your javascript would then display any conflicts if there are any.

    The controller might look something like this:

    class EventsController
    
       def create
          @event = Event.new(params[:event])
    
          unless params[:preview]
             @event.save
          end
    
          respond_with @event, :include => :conflicts            
       end  
    end
    

    I’ll leave the javascript to you! 🙂

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

Sidebar

Related Questions

I have a system that relies on other models but want to make it
I know that NLTK has it. But any else?
I could probably find this out from somewhere else but thought it would be
This question was asked earlier by someone else but never answered: MKAnnotation - Map
I was wondering what are the benefits of using anything else but Java for
I need to capture either \d+\.\d+ or \d+ but nothing else. For instance ,
I can't figure out how to log info-level messages to stdout, but everything else
Something else perhaps? I am already using nHibernate, but I get occasional issues where
has anyone else experienced this . I have SP1 but i have to kill
I am a C# programmer but dabbling in VB.Net because everybody else in my

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.