All Questions
91 questions
0
votes
0
answers
40
views
Rails UJS Remote Form Only Evaluates JS for 2XX Responses but Not 4XX Responses
Was there a change in how JQuery 3 and Jquery 1 handled remote form errors on Rails?
In the past, (Rails 6, Zurb Foundation, Jquery 1), the code below would work. A user would submit a form, they'd ...
1
vote
0
answers
84
views
Where am I loading jquery_ujs in my Rails 6 app?
Bugsnag is reporting this error on many pages: "If you load both jquery_ujs and rails-ujs, use rails-ujs only"
Rails 6.1.3, with webpacker.
application.js:
//
//= require rails-ujs
//= ...
0
votes
0
answers
118
views
$ is not defined error in production environment Rails 5.1.7
jQuery and ujs work fine in the development environment, but are not working in production environment.
This is what my code looks like:
application.html.erb
<html>
<head>
<%= ...
3
votes
0
answers
2k
views
How to set up Rails UJS along with Turbo?
I'm confused as to exactly what I need to do to run my old jQuery snippets and Rails UJS along with Turbo.
DHH added this PR in June that was supposed to improve compatibility, but it lacks details on ...
1
vote
2
answers
613
views
Upgrading to rails 5.2 - remote forms now refreshing the page
I am trying to upgrade a Rails 5.1.7 application to 5.2.0. Some forms on the site were broken by the upgrade. The template for the form looks like this:
<%= form_with model: record, url: ...
0
votes
1
answer
43
views
Remote form opens all other remote forms on the page
I have a user dashboard controller with multiple remote forms inside the same view for the user to update misc attributes:
class CustomerDashboardController < ApplicationController
def settings
...
0
votes
1
answer
755
views
Rails "ajax:success" call multiple times
I'm creating a model to show user's following and follower list just like Instagram:
My controller:
def create
@relationship = current_user.active_relationships.new followed_id: @user.id
if ...
0
votes
1
answer
201
views
Unobtrusive-JS function not triggering when new records deleted when using jQuery-ujs with Rails
Rails: 5.2.0, Ruby: 2.4.1p111, Browser: Chrome 66.0.3359.181, jquery-rails gem: 4.3.3, Turbolinks disabled.
I am following this AJAX on Rails with Unobtrusive JS tutorial and have reached the end, ...
0
votes
2
answers
6k
views
Rails 5: Submit form with jQuery
I am trying to submit a form with jQuery if any of the element changes. For now I am not using remote: true.
Here is the code that renders the partial:
views/assets/index.html.erb
<%= render @...
46
votes
4
answers
45k
views
Rails data-disable-with re-enabling button
I have a Rails Devise form that has javascript validation. When the user presses submit, the validation works and the user is refocused on the form where they need to be.
However, rails uses the ...
0
votes
0
answers
105
views
How to handle UJS when using Rails-assets.org Jquery (or exclude dependencies in a Rails-assets gem)
I've recently started using Rails-assets.org and noticed that, if a particular asset has jQuery as a dependancy, it installs a version from Bower when bundling. This duplicates the jQuery package in a ...
0
votes
3
answers
564
views
In first load of action, how do I pass instance variables to js.erb?
I have a ProfilesController that has the following:
if @profile.ratings
@rating = @profile.ratings.find_by(user: current_user)
end
When the page is just loaded, before it even sends a request back ...
0
votes
1
answer
1k
views
Remote modal form in rails, not triggering AJAX events
I have created a modal form in Rails, that submits values remotely using AJAX.
For some reason, submission of the modal form itself, does not trigger any AJAX events. If I add the exact same form ...
1
vote
1
answer
1k
views
Rails remote link modal to create and edit records
I have followed the tutorial found here
What I'm trying to accomplish, is to allow users to edit records from the index page, using modals.
In my index.haml view I have this:
- @bars.each do |bar|
= ...
0
votes
1
answer
884
views
How do I bind a Jquery submit to a form_tag form submission action in rails
In my rails app I'm submitting a range of forms via AJAX - normally via a modal. In order to do so I use the following code:
$(document).ready(function(){
$(form).on('submit', function(event) {
...