Questions tagged [ruby-on-rails]

Ruby on Rails, a full-stack web application framework written in the Ruby programming language, stands out as an exceptional open source solution. Renowned for its adherence to the widely acclaimed MVC framework model, it has gained popularity for its implementation of the "convention over configuration" philosophy in the realm of application development.

Tips for transferring data via ajax to rails 3. The jQuery function is ensuring the string is properly handled

I am attempting to achieve the following: $.ajax({ type: "PUT", url: /example, data: {_method: "put", "foo_model[bar_attribute]": value_var } }); It is working as expected, but I need to dynamically construct the part foo_model[bar_attribute]. ...

Displaying a pop-up message in Rails upon modifying a Model

Would it be feasible to implement the ActiveRecord Callbacks before_create after_create before_save after_save before_destroy after_destroy in order to showcase notifications to the user using jQuery? Could someone possibly share an example?? Appreci ...

The Rails base file contains a function, let's call it function A, which calls another function, function C. However, function C is defined in two separate JavaScript files

My project includes an application_base.js file with a function: function drawLocations(canvas, blag, blah) { //do some stuff selectLocations(a_something, b_something); //do some stuff } For Page 1: page_1.js function selectLocations(a_somet ...

Using the Rails cocoon gem to populate numerous input fields

I'm currently implementing the cocoon gem in my rails application, where I have a form with two nested fields (categories and subcategories). Initially, only the first field is visible while the second one remains hidden. When the first select field h ...

Utilizing numerous Rails API POST requests has become a common practice

Currently, my ReactJS application is connected to a Rails 5 API. The React application sends a single JSON POST request to api/v1/job in order to create a new job record. This request contains information for two HABTM relationships with Tools and Technol ...

Harnessing the Power of JSON in Rails to Enhance Your jQuery UI Autocomplete Form

In the context of a rails application, I have been exploring different methods to fetch data from a JSON file. Despite my efforts, I have not been able to find a solution that suits my requirements. The static data I have is quite extensive, consisting of ...

Whiskey Angostura and Straight Row Set to 8, not 12

Recently, I incorporated Bourbon, Bitters, and Neat into my rails application. However, I am encountering an issue where the number of grid-columns is stuck at 8 instead of the desired 12. To address this problem, I have taken the following steps: Ensur ...

Loading a Single Partial in Rails After the Page has Rendered

In my application, I have a partial page called _dashboard.html.erb. Within the dashboard, there are multiple calls to render different partials. One of these is the _calendar.html.erb partial, which retrieves events from Google Calendar and displays them. ...

Issue with Material UI DateTimePicker not submitting default form value

Currently, I am utilizing React for my frontend and Ruby on Rails for my backend. My issue lies in submitting the value from my materialUI DateTimePicker via a form. The problem arises when I attempt to submit the form with the default DateTime value (whic ...

Rails GridView inspired by Yii framework

I have been using Yii for a considerable amount of time, but now I am interested in exploring the possibilities with Ruby on Rails. Although I have always had a fondness for Yii's GridView because of its simplicity in displaying records from the database ...

Troubleshooting Problems with Ruby Arrays, JavaScript, and JSON

I am facing a challenge with rendering a highcharts plugin in my rails application. I suspect it could be related to the sql queries fetching data from the database and converting them into a ruby array that the javascript code fails to interpret correctly ...

What is the process for generating a new object through an Ajax call?

Let's say I have my main view displaying all the items stored in the database. Instead of manually clicking on a Create button, I want to utilize Ajax to add new items without refreshing the page. How can this be achieved? What changes should be made ...

Improving the Efficiency of Database Queries in Ruby on Rails

Currently, my team and I are collaborating on a Rails side project that involves loading a substantial amount of seed data. This data is stored in a JSON document with nearly 3200 JSON objects, each having the same three field names. After parsing and see ...

The margin property in jQuery does not seem to be functioning properly when trying to send

Within the view page, there is jQuery code that sets a margin on a div. Below is the code: <script type='text/javascript'> $('#someID').css('margin-left', '10px'); </script> This code functions properly when the page is requested through a ...

Sending Rails form data to a JavaScript click event

I'm currently working on a user profile form with a "Submit" button that triggers some client-side validations before proceeding. In my code, I've set up an intercepting click event on the submit button to run the validations and then proceed wi ...

Troubleshooting issues on Heroku through log analysis

My project consists of a React frontend with a Rails backend, deployed using NPM. The deployment was successful initially, but now I'm encountering an error when trying to fetch data: heroku[router]: at=error code=H10 desc="App crashed" method=GET pa ...

Is it conceivable that Rails may be rendering HTML at a slower rate compared to static

When using a Rails layout, you can include HTML tags to render images like this: <%= image_tag("logo.png", :alt => "Sample App", :class => "round") %> This will generate the following HTML code: <img alt="Sample App" class="round" src="/i ...

Tips on displaying the appropriate object value in a text field based on the selection from a dropdown menu

In my Ruby on Rails form, I have a dropdown menu with various category names: <td> <div class="div1"> <%= f.collection_select(:category_id, Category.all, :name, id: 'category_select', :include_blank => '---select ...

Managing User Session Timeout in Ruby on Rails with Devise

My application is utilizing devise for security, with a session timeout set to 30 minutes. Everything works fine when users navigate normally - if they click a link after timing out, they are redirected to the login screen with a message stating "Your sess ...

Updating MongoDB every 30 seconds using remote JSON data: A step-by-step guide

I'm currently working on parsing remote JSON data and storing it in MongoDB. The JSON data I am dealing with is dynamic, so I want to continuously update MongoDB with this dynamic data every 30 seconds. Here's an example of how I parse the JSON data: req ...

Which is the preferred method: utilizing ajax calls from assets/javascript/*.js or *.js.erb views?

I am developing an admin service on Rails that communicates with a network communicator. Here is my challenge: When a user clicks a button, they are presented with network groups to choose from. Once the user selects a group, they should be able to see th ...

Decipher the communications sent by the server

I have been working on a hybrid application using vuejs and ruby on rails, and I am trying to figure out how to translate the error messages that are generated by the server. While I have managed to translate the titles easily with a method, I am strugglin ...

Is there a way to receive live updates for records in real-time using push notifications?

I am in the process of developing a Ruby on Rails ecommerce platform that enables potential customers to place orders while allowing the store owner to receive them instantaneously. Once an order is finalized, it will be saved into the database (currently ...

Issue with page refreshing not functioning on localhost in Rails and AngularJS collaboration

I recently encountered a strange issue while working on my Rails 4.2 + AngularJS 1.5 project. Whenever I attempt to refresh (F5) the main web-page, there's about a 9 out of 10 chance that the refresh doesn't happen correctly. In these cases, all I can see ...

Ruby on Rails: clearing the asset pipeline cache by hand

While Rails usually clears the asset pipeline cache automatically when files are modified, I am facing a unique situation. I am providing my application as an HTML response to an Ajax request, cross-domain using rack-cors to bypass CORS. The issue arises ...

Unexpectedly, the kaminari pagination ajax request directs to an incorrect controller

Let's kick things off with the conversations/index.html.haml file to generate a message #new_message_conversation .panel.panel-info .panel-heading %h4 Send a Bark! .panel-footer(style="paddin ...

Rails: Parameters are displayed in the console but cannot be accessed via params

I sent a get request to the following url: groups/:id.json Upon checking my Rails server console, this is the output: Processing by GroupsController#show as JSON Parameters: {"id"=>"11"} However, despite these parameters being passed, I am unable t ...

Can a non-gem package be installed as a Ruby gem?

I have a basic front-end library that is designed for ajax requests. To add it, you can follow these installation steps: jam install qwest bower install qwest npm install qwest --save-dev You can also find this library on github at https://github.com/pyr ...

Attempting to wipe out a request using ajax to access relationship entities in a ruby on rails framework

I'm currently working on implementing an ajax request to delete a "budget" (known as "orçamento" in Portuguese). These budgets are associated with a "cadastre", where each cadastre can have multiple budgets. Below, you can find the components involved: o ...

The jQuery Modal Dialog functions properly on the initial page load, but fails to work on subsequent pages unless manually refreshed

So, I've encountered an issue with my jQuery modal dialog. It's set up to remind non-registered users to sign up when they try to access user-only actions. Oddly enough, the dialog functions perfectly after a page refresh on THAT specific page. H ...

Exploring Ajax independently in Rails without the use of helper functions

Can Ajax post requests be made in Rails without using remote helpers? I am attempting to achieve this with the following code (including the coffeescript below). However, when I try to submit the form, I encounter an ActionController::UnknownFormat error ...

Utilizing AngularJS to retrieve associated information from users via a JSON API

I'm currently utilizing the Ionic framework and my inquiry relates to AngularJS. I've set up a JSON API using Ruby on Rails and for authentication, I've opted for ng-token-auth + devise-token-auth. User JSON: { "data": { "id": "1", "type": "us ...

Updating a Rails form with a dynamically changing belongs_to select field

My Rails3 app has a Site model, connected to a Region model which belongs to a Country. Currently, the site form includes a select field for Region filled from the Region model. However, I want users to update this list dynamically. I attempted to create ...

Cannot see the created item in Rails application when using RSpec, Capybara, Selenium, and JavaScript

Currently, I am in the process of developing a web store. The key functionality is already implemented where all products are displayed on one screen along with the list of ordered items. Whenever a product is selected for ordering, it should instantly app ...

Exploring the capabilities of the jQuery `val()` function alongside the dynamic framework

Whenever I have a JavaScript variable that contains HTML printed from a table on my server, I encounter issues when using it in a jQuery function like val(). The problem arises every time someone enters content with special characters like " or '. Thi ...

Decoding Rich Text Content into Coherent Array Components: Strategies for Splitting Text and Images

I've been developing a blog platform that uses Rails as the backend CMS and React for the frontend. In my Rails application, I'm making use of a rich text editor to create content. The content is then passed from the backend to the frontend to po ...

Ways to retrieve the body from a Ruby on Rails request

I attempted to make a Postman request to the following endpoint using this body: { "username" : "Sebastiansantander", "password" : "1233342" } Even though I tried using params.permit[:username,:password], I e ...

Transferring a parameter from link_to to a popup window in a Rails application

I am facing an issue with passing an object to my modal in Rails. The object has a table of results with an attribute "email", but I seem unable to pass it so that I can use it within my modal. index.html.erb <div class="modal fade bs-example-modal-lg ...

Cookies or Services: A Debate on the Best Practices for Storing Cart IDs

Technology Stack: React Node.js Choice 1: Upon receiving a request for "/", the server generates a cart in the database and saves the id in a cookie. Angular fetches the id from the cookie to use it in managing the cart. Whenever a purchase is made, t ...

Rails controller did not receive the Ajax call

I have noticed that when I make an Ajax call using jQuery, the data is always transmitted (status 200), but there are times when it's not properly received by the Rails controller. The data is sent correctly, but most of the time the controller responds wi ...

Switching a Rails/Ajax form from create to update mode upon submission

While experimenting with a star ratings page, I encountered an issue where the form element remained in "Create" mode instead of updating to an "Update" method after submission. The rating form is ajaxified, but it lacks the functionality to dynamically sw ...

How can I automate testing with Cucumber using Rails and Capybara to manage an AngularJS dialog box?

Currently, I am developing an application that utilizes AngularJS. There is a flow in the application where clicking a button triggers a dialog box to appear with various fields. I am facing an issue when trying to input values into the fields within the ...

Learn how to update image and text styles using Ajax in Ruby on Rails with the like button feature

I'm working on implementing a Like button in Rails using Ajax, similar to this example: Like button Ajax in Ruby on Rails The example above works perfectly, but I'm interested in incorporating images and iconic text (such as fontawesome) instead of just u ...

Unexpected closure occurred with status 1 using Firefox webdrivers in the context of Watir automation (Ruby on Rails)

My Rails application includes the following gems: gem 'headless' gem 'watir' gem 'webdrivers' gem 'watir-screenshot-stitch' gem 'watir-scroll' I am using Debian 9 and have installed sudo apt-get install f ...

Bourbon encountering difficulty with font-face mixin in Rails version 3.2.2

After watching Ryan Bates' screencast on Bourbon, my application.css.scss file looks like this: @import "bourbon"; @import "main"; @import "events"; ..etc. In my main.css.scss stylesheet, I am able to use the @include transition() mixin without any issue ...

CommentsController#new encountered a NoMethodError due to an undefined method called 'text' for the Comment with the following attributes: id: nil, author: nil, created_at: nil, updated_at: nil

I'm currently integrating rails with react to include a comments section in the app I am developing. While the /comments page is functional, I encountered an error when attempting to create a new comment. Despite consulting the guide I am following, the is ...

Experimenting with Capybara to upload files - circumventing a conventional form by using a button and a specialized JavaScript

I've been struggling to figure out how to make that test function properly. I've tried multiple approaches but nothing has worked so far. I have a button <div > <a href class="btn btn-default btn-block btn-lg btn-shadowed ut-upload- ...

Callback not being triggered after AJAX request

I am currently troubleshooting some code that was not written by me, and I am facing challenges in understanding why an Ajax return is not triggering a Callback. The following code is responsible for attaching behaviors to the ajax functions: # Callback ...

Rails gives a response of HTML when angular sends a resource.get request

Having trouble with Rails 4 responding to an angular resource.get request with HTML instead of JSON. The code snippet for the javascript is as follows: $resource("/questions/:id", {id: "@id"}}.get({id: 16}); The server error occurs because it cannot loc ...

Creating JOIN tables within the create action involves assigning related ids to each table

I am currently working on a room reservation system that involves including options for each room. Data related to the options and their join table, reservation_options, are successfully inserted into the params. However, I am facing an issue with assignin ...

What is the method for embedding a concealed form within a table?

I am a beginner in HTML and RoR. I am trying to include a button inside a table that will submit a hidden form. However, I am facing an issue where the button is not showing up in the generated HTML. <table class="centerBox"> <h3>Search Resu ...

How can we redirect to another page after checking a box?

In the scenario where a checkbox is checked, how can the page be automatically redirected to @habit, simulating the behavior of clicking a submit button? habits/show <% if @habit.current_level_strike %> <div class="btn" id="red"> <l ...

Sending requests through RoR and receiving JSON responses - what's next?

Hey there! So I'm diving into the world of Ruby on Rails and I've managed to create a form that sends data to an external widget which then returns JSON. Here's what my form looks like: <%= form_for :email, :url => 'http://XXX.X ...

Combining multiple models in a single view using Ruby on Rails with ajax

Currently, I am in the process of developing a Ruby-on-Rails web application that serves as a tool for tracking product technical specifications. This marks my initial attempt at creating a RoR app after completing Michael Hartl's Rails Tutorial. Despite m ...

Performing AJAX in Rails4 to update boolean values remotely

Suppose I have a model named Post which includes a boolean attribute called active. How can I efficiently modify this attribute to either true or false directly from the list of posts in index.html.erb using link_to or button_to helper along with remote: ...

Mastering the art of transferring render :json => data to d3.js

I want to display the output of a JSON file as a d3.js graph, but I'm having trouble accessing the JSON data in my controller. Here is the relevant code: First, let's take a look at the model: class User < ActiveRecord::Base has_many :relationships e ...

ActiveModel::UnknownAttributeError (attribute 'order_items_attributes' is not recognized by Order model.):

Can someone please assist with this problem? ActiveModel::UnknownAttributeError (unknown attribute 'order_itens_attributes' for Order.): Here is the code from my controller: def create @order = Order.new(order_params) if @order.save ren ...

What is the best method for sending React and AJAX data to a Rails server?

I'm currently working on an application using reactjs for the frontend and rails for the backend. Although I'm new to rails, I've managed to create a registration system using reactjs. Now, my next challenge is posting data to the server without using rea ...

Preventing simultaneous ajax requests

Similar Question: How to stop a jquery.load() request? So I'm dealing with an autocomplete field that's sending an ajax request every time a key is pressed, causing significant slowdown. If you check out this link and log in with the details ...

Maintaining the format of forms input in Rails and HTML: Tips and tricks

Hey there! I'm working on a Rails app that has a simple HTML form. One of the fields is called description, which is a text_area. I want to be able to display its input exactly as it was entered on the index page. For instance: If someone enters a l ...

Integrate selection feature into collection_select method for jQuery in Rails

I have come across this form: <%= form_for(@post) do |f| %> <%=f.collection_select :post_id, Board.where(:user_id => current_user.id), :id, :name %> <%= f.submit "Post it"%> <% end %> I am looking to dynamically add a new optio ...

Obtaining two divisions that simultaneously display partials in a parallel manner

It's proving difficult to align two divs containing rendered partials side by side within a form. Strangely enough, when I replace the divs with plain text, they respond perfectly to my style changes. However, as soon as I include the render code, they stu ...

Obtaining the source code in CKEditor while in edit mode with Rails

As a Rails developer, I recently utilized CKEditor in one of my applications. After writing a sample HTML source code in the editor and submitting it, the code displayed properly on the front-end as a GUI. However, when attempting to edit the source code f ...

Exploring the depths of nested objects within my Rails JSON data structure

I am looking to structure a nested JSON format for my Event model that resembles the following: "event": { "quiz": { "name": "", "desc": "", "events": [ { "name": "general quiz", "desc": "" }] }, "dance": { "name": "", ...

Updating URL parameters with an AJAX request in Rails 3 is a great way to dynamically

I am working with a filter and a list of products that have an id, name, and creation date. The filtering can be done by id, name, or creation date. When I make an AJAX request to update the content div, the URL stays the same. How can I add parameters t ...

Confirming the user's login status using AJAX on the front-end

Currently facing the following issue: I am working on a Rails (version 3.2.8) application that utilizes devise for authentication. The backend is a RESTful API while the front-end consists of a backbone one-page app. Although I have successfully implemen ...

Guide on modifying a field in a table when a checkbox is selected using Angular

I have a task that involves updating the fields in a database table to TRUE (boolean field) when a checkbox is checked, and FALSE when unchecked. Below is the code for the checkbox in my Angular HTML page: <checkbox-field attribute='updateExistingItem ...

Verify the presence of a particular attribute in an HTML tag using Capybara and polling techniques

In my HTML code, the attributes of buttons (such as "AAAAA") will change based on external events. This real-time update is achieved through AJAX pooling. <div class="parent"> <div class="group"><button title="AAAAA"/></div> <di ...

"Utilizing Javascript in an ERB view file within the Rails framework

In my .js.erb file, I need to execute a conditional statement when an ajax call is triggered. Below is the code snippet: function updateContent() { $('.organiser__holder').html('<%= escape_javascript render("filter_links") %>' ...

Rails: Ensure that JSON form fields remain populated in case the form encounters a validation error

I am using a rails simple form to create a product with three fields inside in order to associate it with appropriate categories: <div class="form-group"> <%= f.input :child_category_id, :collection => @categories.order(:name), :l ...

Using AJAX to filter array values in Rails 3 views

In my project with Rails 3.1 and Ruby 1.92, I am working on enabling users to filter a list of products based on the product type attribute and update the list asynchronously using AJAX after their selection. My strategy involves creating instance variabl ...

Employing AJAX with a pair of dropdown menus in Rails version 4

In my view, I have two select boxes - one for companies and the other for employees. Both have a blank option. When a company is selected, it populates the list of employees based on that company. Everything was working fine until I encountered an issue. ...

What is the best way to retrieve the data submitted in the Input field by using Ajax?

One feature I'm working on involves an input field within a form where users can update their name by clicking a button. The goal is to capture this change in the input field using Ajax and update it accordingly. Here's the HTML code snippet: <p id="n ...

Issues with jQuery Ajax functionality in Rails application not achieving successful completion

When a card is moved onto another stack, an Ajax call is triggered twice. This only happens when there are multiple stacks. However, if the cards are rearranged within the same stack, the call is triggered only once. The Ajax call sends an array of IDs fo ...

Enable CDATA support in ActionView::Base.full_sanitizer

One method I found helpful was using the ActionView::Base.full_sanitizer.sanitize(value) to remove HTML content. It generally works well, but there is an issue when the value passed into the method is wrapped in because it returns a blank ...