My comment form has a feature that displays the content of the text area using js. It functions properly unless a new line is entered in the text area, in which case it does not show up right away. However, after refreshing the page, the comment appears wi ...
When I use my mock stub, the escaping works properly, but with the API response, the escaping does not seem to be applied for some reason. Here is a snippet of my Mock stub factory. require 'faker' F ...
I am currently working on a project with the following setup: index.html.erb -> link_to "click me " , 'customers/index' , :remote => true . controller -> customers def index end index.js.erb alert('in my js file'); The alert ...
Although there are similar questions about this issue, mine seems to be caused by having the javascript tag in the head rather than the body. Moving my js outside of the page change block is not an option for me. I stick to Rails convention by organizing ...
Currently working with Ruby on Rails 4 and incorporating the RABL gem into my project. I am seeking a way to reuse templates by rendering the show.json.rabl view from the index.json.rabl while following the standards outlined at jsonapi.org (source: RABL d ...
Is there a way to implement like/dislike functionality in my RoR application using Ajax requests? I have integer values for both like and dislike counters. How can I use Ajax requests to increment either the "like" or "dislike" counter in my methods? In ...
I have encountered a strange bug in my JavaScript code. When I translate the page to another language by clicking on "English | Русский" using simple I18n translation, my menu buttons stop working until I reload the page. I suspect that the issue ...
Currently, I am in the process of creating RSpec test files for a controller that exclusively responds in JSON format. The primary function of this controller is to serialize a Service object into a JSON object, and so far, this functionality is performing ...
Within my application, Users have the ability to recommend other Users' profiles seamlessly. The functionality related to models and associations is working perfectly, as I am able to identify which users have recommended the current_user's profile by util ...
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. ...
Wondering how to ensure that the click handler is always attached in my Rails 4.1 app where I am using JQuery-ujs to update cells in a table within the comments#index view. In my comments.js.coffee file, I have the following code snippet: jQuery -> ...
I have managed to solve 90% of my issue with previous questions, but I've hit a obstacle. My models include CheckIns and Person, where CheckIns are associated with People. In my controller, I currently have this code: data = CheckIn.all render json: { d ...
I have created an application with 4 buttons, each representing a different directory. When a button is clicked, an Ajax call is made to generate a JStree element displaying the directory hierarchy. Everything works perfectly when I click on the first but ...
I have a Rails application with two different user models that represent distinct roles (no Single Table Inheritance - each model is separate). I am considering transitioning to AngularJS for the frontend. I want to determine the most effective way to str ...
I am attempting to create a dynamic selection menu following this tutorial; however, I am encountering issues as the select statement does not seem to be updating. Below is the code snippet I currently have: #characters_controller.rb def new ...
I'm currently attempting to implement a d3.js graph into my Rails 4 application by following a tutorial found on this website. The example application provided on GitHub works perfectly as expected. The issue I am facing is that when I try to recreate thi ...
Recently, I encountered an issue with an ajax call that retrieves a date from the database. The date is stored as a double in the database and then converted to a string. I used Date.parse to change it into a date object and used strftime to format it. How ...
Imagine a scenario where I am working with a basic form like the one below <%= form_for(@category) do |f| %> <% if @category.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@category.errors.count, "erro ...
Looking to display a list of "Interests" for users to "follow" by clicking on a button linked to the Interest's image. Once the follow button is clicked, the Interest and its image should be removed from the list. Attempting to use a hide function in crea ...
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 ...
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 ...
I'm trying to implement an active record association in the DOM, but I'm encountering some difficulties. Here is my editor class: .editing .row .col-sm-3 .col-sm-8 .text-left #font-20 .title-font . ...
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 ...
Encountering a Catch-22 situation with jQuery in my Rails app - when I include jquery_ujs, it pulls the wrong URL from Rails during execution, leading to quiet errors when attempting to access non-existent URLs on the server. However, if I omit jquery_ujs ...
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 ...
I found a helpful guide on this blog to implement a toggle feature for an attribute in my database. While the toggling functionality is working fine, I'm struggling to update my view to reflect the changes. This is my first time using js.erb files so ...
For debugging purposes, I am trying to view the HTML response when making an AJAX request. Currently, when I check the response, I see tags like: <li>something</li> What I actually want is: Something I do not want to see the tags, just the ...
After spending about an hour trying to figure this out, I am still stuck... The action in my oferts_controller.rb file looks like this: def update_categories @categories = Category.children_of(Category.find(params[:categories])) respond_to ...
I am currently developing a web application that focuses on automating CRUD tasks on Amazon. This includes the ability for users to delete and add addresses on their Amazon account. To automate these tasks, I am utilizing Selenium WebDriver with a Mozilla ...
While practicing, I attempted to add a basic message form with an Ajax call. However, I encountered an error indicating that a template is missing. The error seems to be related to the Devise gem and reads as follows: Missing template messages/create, app ...
Is there a way to trigger a JavaScript function when a specific div with a certain class is loaded within my Rails 4 application? <div class="myClass"> hello world </div I am looking for a solution to execute some JavaScript code only when t ...
I have designed User and Pairings models as shown below: class User < ActiveRecord::Base enum role: [:student, :supervisor, :admin] has_many :students, class_name: "User", foreign_key: "supervisor_id" belongs_to :supervisor, ...
Encountering an issue when attempting to include a bootstrap input-group-addon with the input field nested inside a <td> tag within a table. Once all necessary classes are applied, there appears to be some spacing between the sign and the input field ...
My current JSON request is returning the following data, where each person/lender has multiple inventories. #output of /test.json [ {"id":13, "email":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a4cecbcccac0cbc1e4c1dcc5c ...
After receiving this JSON data, I noticed that the created_time value displays the time in integer format instead of a proper time format. How can I convert the created_time into the correct format? "filter"=>"Normal", "created_time"=>"1421677966" ...
Working on Rails 4 and delving into the world of AJAX for my controller actions. Here's what I've come up with: def create @client = Client.new(client_params) if @client.save render :json => {:result => 'success' } else re ...
Currently, I am working on building REST APIs in Ruby and utilizing @object.as_json() for the JSON response format. However, I have encountered a roadblock in customizing the data transfer within the as_json method. I have outlined my specific requirement ...
Currently, I am in the process of integrating an API for online payments. The API is designed using PHP code, but my website operates on Ruby on Rails. Therefore, I need to convert the PHP code to Ruby. Below is the PHP code snippet: $merchant_id = &apos ...
The issue: I am facing a challenge in filtering a collection of Units based on the selection of a collection of Organizations. When an Organization is selected, I want the Unit dropdown-menu to refresh and display only the Units that belong to the selecte ...
I am attempting a straightforward ajax call in Rails 4, but encountering issues with retrieving the json response. Below is the script I'm working with: $(document).on "submit", "form[name=upvote-form]", -> form = $(this) $.post "/vote", $(th ...
I'm currently working on a project with a basic Item model where both "/items" and "/items.json" are functioning properly. However, I am now looking to enhance the API by adding a search parameter like "/items.json?skuid=123" so that only Items with t ...
For those with more programming experience than myself, I have a simple question. In Rails, using coffescript, I want to show additional content based on a user's selection. Essentially, if they click on a checkbox, it should reveal an extra field for ...
Within my application, I have a button that triggers an action called "method" present in the UserController. This particular action involves executing some specific tasks. def method ***performing necessary calculations and operations*** @my_variable ...
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: ...
<%= link_to "Sign In", new_user_session_path, :method => :get, style: "color:white" %> <h3>Read More - <%= link_to 'Article', action: :articles, style: "color: purple" %></h3> <%= link_to 'Click to Read More Abo ...
I'm facing an issue with the following view and controller. Despite specifying 'remote: true', kaminari is making a regular HTTP request instead of an AJAX call when navigating through the paginated links. I can't figure out what I might be missing to make ...
In my current project, I am facing a challenge where I need to make an API call to a client to retrieve product information by providing the product_id. Unfortunately, the client's API only allows one ID at a time, which complicates the task signific ...
After making an AJAX request, I receive a response which is then saved to a data variable. This is the controller logic: def retrieve data = params[:data] @question = Question.find_by(id: params[:question_id]) @choices = @question.choices results ...