addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1linklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

JavaScript/CoffeeScript problem in Rails search form

From: Jason H.
Sent on: Monday, August 12, 2013 11:51 PM
I have two Rails apps up and running, Bargain Stock Funds and Doppler Value Investing.  Please note that I haven't done any Javascript programming beyond the "Hello World" stage.

Both apps have search engines that uses the Ransack gem (for the search form) and the Kaminari gem (provides paginated results).  The search pages are http://www.bargai...­ and http://www.dopple...­ , respectively.  The URLs for the source code are­ and­ , respectively.

In the production environment (the one that sees the light of day), the "add field" and "remove" buttons on the Doppler Value Investing search page work, but the "add field" and "remove" buttons on the Bargain Stock Funds page do not work.  What's even stranger is the fact that the "add field" and "remove" buttons do work in the development environment.  Yes, the Bargain Stock Funds search page works in the development environment but not in the production environment.

I posted about this on the Google group, and Joshua Wehner suggested that I have a problem with JavaScript and/or CoffeeScript.  Thus, I've decided to post here as well, as this is the forum where the top JavaScript people congregate.

The JavaScript/CoffeeScr­ipt file on the Bargain Stock Funds site is app/assets/javascrip­ts/ script.  The analogous file on the Doppler Value Investing site is app/assets/javascrip­ts/ .  Both have the following code:

# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: 
jQuery ->
$('form').on 'click', '.remove_fields', (event) ->

$('form').on 'click', '.add_fields', (event) ->
time = new Date().getTime()
regexp = new RegExp($(this).data(­'id'), 'g')
$(this).before($(thi­s).data('fields').re­place(regexp, time))

Exactly how can I get an error message to appear?  Until I get an error message, I have no way of properly troubleshooting this.  I have downloaded and installed FireBug, and I'm in the process of trying to make sense of it.

Jason Hsu <[address removed]>

Our Sponsors

  • Twilio

    Pizza sponsor and a Super simple API for SMS, MMS, Voice/VoIP

  • Olson

    The great people at Olson are providing us the space for our meetings.

  • TrackJS

    Food Sponsor and awesome error reporting

  • ReachLocal

    Video Streaming Sponsor

  • Empulse

    Video Streaming Sponsor

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy