Questions tagged [ruby-on-rails]

Ruby on Rails is an open source full-stack web application framework written in Ruby. It follows the popular MVC framework model and is known for its "convention over configuration" approach to application development.

0
votes
0answers
5 views

Cannot open files in MS Word from Rails Webdav server

I created a webdav server within my rails app using the rack-webdav gem. I use Rack basic authentication in my rails application. When using libre office, I am able to 1. see the file in the file ...
0
votes
0answers
7 views

Finding an object in db and attaching an extra param from another table in ActiveRecord

I have two tables in my db: accounts and transactions. They look more or less like this, with relevant columns and example entries: accounts id | uid | ------------------ 1 | "abcde" | ...
0
votes
0answers
6 views

Filtering parent model based on child scope

With the help of this post I was able to create a scope to filter trending boards. I'm now looking to create a scope on the boards parent model. So instead of getting the boards returned, I want all ...
0
votes
0answers
7 views

Is there a way to get around H12 timeouts in Heroku using griddler to parse inbound messages with large attachments from sendgrid

My workflow is email--sendgrid--griddler and the rails app runs on heroku. All inbound emails have attachments, and some are rather large. I keep getting H12 timeouts on Heroku because the attachments ...
0
votes
0answers
4 views

Sidekiq worker best practices for recurring jobs

I'm trying to define what the best/most efficient way is to schedule background jobs on sidekiq. I need this jobs to run periodically (i.e every 15 minutes, every day, etc.) for each user. The jobs ...
0
votes
0answers
8 views

Jbuilder stopped working after migrating from Mongoid to ActiveRecord

I have an existing Rails project (API only) that used Mongoid as its ORM, and Jbuilder for rendering. I refactored this project into using ActiveRecord with MySQL. Everything went smoothly, except ...
0
votes
0answers
35 views

Error parsing Gemfile when pushing to Heroku

I have an existing rails app in Heroku and I'm trying to push it there but it gives me this error everytime I try to push to Heroku There was an error parsing your Gemfile, we cannot continue remote: ...
-1
votes
1answer
10 views

Rails implementation of input tag firing event on value change

I was wondering if there is some cleaner way to implement event firing on input tag value change (i want it to fire every time character is entered/deleted) and make these values visible in controller ...
-4
votes
0answers
17 views

'No serializer found for resource' - active_model_serializers

Problems with 'active_model_serializers' No serializer found for resource: active_model_serializers Rendered ActiveModel::Serializer::CollectionSerializer with SalesSellerStore::ActiveRecord_Relation ...
-3
votes
2answers
23 views

when running rails s after switching from my server to my employers server, I am getting these errors:

rails s worked on my server and after switching servers, I got this error when running rails s. What could be causing this? Traceback (most recent call last): 4: from bin/rails:3:in `<main&...
0
votes
0answers
6 views

Rilas js.erb file not executing js after webpacker added

I have a Rails app using the asset pipeline and webpacker. Theoretically, webpacker and the asset pipeline won't interfere with one another but I'm seeing a strange issue when it comes to executing ...
1
vote
1answer
11 views

Multiple chatrooms on one page requires multiple channels or not?

I am building message chatrooms part of the app and I was wondering do I need multiple channels. I am going to have specifically 4 chatrooms per URL.
-3
votes
0answers
10 views

I would like to add a class on an element based on the inner text of the child element using Nokogiri in Ruby on Rails

activeAction = Nokogiri::HTML.parse(actions) activeAction = activeAction.xpath("//aside") activeAction.search('p').each do |anchor| if(p.inner_text == 'complete') activeAction.xpath('//p'...
-1
votes
0answers
21 views

Rails: Calling methods in a model in a different controller

Please, I really don't know how best to achieve refactoring this code following the best rails practices. I am trying to call some methods that are defined in a model in my rails application in a ...
0
votes
1answer
16 views

Rails wildcard route with full URL in param

I want to redirect to any given URL. I am trying this: Route: get 'track/*redirect_url', to: 'tracker#track' Controller: redirect_to params[:redirect_url] However when I visit tracker URLs - I ...
0
votes
0answers
9 views

How to get image path with $(document).ready when using webpacker

I'm setting up a Rails app with Webpacker, and integrate jQuery Raty. With Raty, I need to specify a few image paths. I tried but webpacker can't find the correct paths. My current js snippet is ...
0
votes
1answer
17 views

Convert Active Record Object into Hash

I have a model Person with fields email, name, age, phone_number. I want to convert Person.all to a hash. The hash should have the structure as follows: { "email1" => ["name", "age", "phone_number"...
0
votes
1answer
20 views

I would like to see the rails application in elastic beanstalk, but I can be angry at the ruby ​version

I would like to see the rails application in elastic beanstalk, but I can be angry at the ruby ​​version. However, no description of 2.4.1 can be found anywhere. What kind of problem do you think? ...
1
vote
1answer
23 views

Submit button not saving my subscriber Ruby on rails

I am working on a website and I want to add a subscribe button to get email from users to send them some information but when I enter the email address and press the submit button, the User ...
0
votes
2answers
10 views

Image Loop with Semantic UI slider rails

I'm trying to loop some images attached to a post using a custom UI semantic slider from here. This is what i have tried so far but it's only showing the first image from the loop. <div class="...
0
votes
1answer
26 views

How to fix issue with post requests from arduino, only being received 2-3 times before failing

I'm currently trying to send data collected from sensors on an Arduino WiFi rev2, to my rails server hosted on Heroku. I do this by sending my data in a JSON format. My problem is that while my ...
0
votes
2answers
13 views

Rails Active Record .paginate, Get First page(row), if page (row) specified doesn't exist in database table

In rails 4.2, I am using paginate method to get paginated records from db. I want to get first page, if specified page is not present in the db. I am using following active record functionality to ...
0
votes
0answers
14 views

How do i achieve single sign on with aws-sdk ruby library

How do I achieve the SSO functionlity with aws-sdk ruby gem as i have seen the library classes of aws-sdk and not found any of the SSO class or methods inside this gem.
-1
votes
0answers
7 views

Facing some issue while performing some action on an excel sheet

Opening an spreadsheet perform some operation on it like adding values to some row's and column's perform write operation Issue faced - Error occurs while opening the file workbook = Spreadsheet::...
0
votes
0answers
23 views

Put value from Typescript front to Ruby backend (Elasticsearch)

I'm not good at TypeScript - and now i have it on the front of supported web application. The main problem - i need some case to take values: from Front of Angular CLI and put them on Ruby/Rails ...
0
votes
1answer
34 views

Rails 5: How to save uniq element in Array of Hash get from API's response

I'm try to use API from a logistics company in my country to Get District List, Calculate Shipping Fee and Create Shipping Order Get District List response format is like this: data: [{ ...
1
vote
0answers
54 views

API calls are failing in Rails 5.2.2 & Ruby 2.6.2

I have upgraded my rails application to ruby 2.6.2 and rails 5.2.2. After upgrade API calls are failing with the following error message. Kindly help me to solve this issue. 2.6.2 :004 > ...
0
votes
1answer
28 views

Editable row in rails using java script

I want to make each row editable in table. For this I place rows with text_fields in each bellow the row with table data. <style> .dtr{ display:none; } </style> <body> &...
0
votes
1answer
36 views

can't write unknown attribute `example` typed_store - Rails

I have this models where I wanna update my typestored columns using update_columns active record I have searched numerous answers in stack, doesn't seems to have lot of resources regarding typestored....
-1
votes
0answers
33 views

Would development be any different if I were to use postgresql instead of sqlite3?

I'm still new to rails and I also want to deploy a project on Heroku but I can't deploy my app since because of the sqlite3 gem even though I added postgresql in my gem file. So my quesion is: ...
-2
votes
1answer
25 views

how to display values from has_one association in rails?

I want to Show Data in view. class Employee < ApplicationRecord has_one :bank_account end class BankAccount < ApplicationRecord belongs_to :employee end
0
votes
2answers
39 views

Rails joins query killed or just too slow. Please recommend the proper way to create queries

I am having trouble properly creating query with joins. It starts to talk to server but it ends up clogged and saying "killed" (in Rails console) I have to models. One is 'User', the other one is '...
0
votes
0answers
22 views

How to make output in 1 row for xml.builder?

I want have output in 1 row text: <A><d>n</d>Im newspaper text</A> I used xml.A { |t| t.d "n"; t.text! advert.newspaper_text } In this case i have output: <A> <...
-2
votes
0answers
23 views

NameError: uninitialized constant User. I lost the reference to Users table and DB operations no longer work. How do I locate source of table ref?

While trying to add Devise into a Rails Api project that already had a Users table, I ran into errors. There was a model and controller for User class, but I had erased the table from migrations ...
3
votes
1answer
23 views

Why is brakeman-guard raising “NoMethodError: undefined method `gsub'”

I'm using the following gems in a Rails 5.2 app. # /Gemfile group :development do gem 'guard' gem 'guard-spring' gem 'guard-rspec' gem 'brakeman', require: false gem 'guard-brakeman' # ...
1
vote
1answer
26 views

Amazon s3: Image link is dead on Gmail

Sending HTML email from the rails app makes image url dead. I build with AWS S3 and AWS SES. views/news_mailer.html.erb <div class="icon"> <%= image_tag @item.image.to_s %> </div>...
0
votes
1answer
17 views

Devise: Unable to redirect to current user edit profile after sign_up

I'm currently working with Rails 6 and Devise for authentication. I would like to redirect a user to edit the form after a successfully signed up. However, after the user signs up, its redirected to ...
0
votes
1answer
18 views

variant delegated to attachment, but attachment is nil

I'm working on a Rails 6 application using ActiveStorage. I'm using devise for authentication which requires on the sign_up page an email and a password. After successfully sign up I would like to ...
0
votes
1answer
22 views

Devise: creating a “profile” using users controller with Devise

I'm working on a Rails 6 application where I was separating the User and Profile models. This caused some issues as shown in this post Rails 6: Only one profile per user should be created I'm using ...
1
vote
1answer
12 views

How to get Rails Admin date filters to follow the Rails app's timezone?

I have a Rails app and use Rails Admin for back-office. I have my app's timezone set to 'Melbourne' but its Date filters only show results in UTC. How can I change this behaviour to follow the app's ...
0
votes
1answer
32 views

Rails remote true form submitting form multiple times

Using remote:true in rails form for submission. But issue I am facing is that sometimes its submitting form multiple times . I read somewhere that its may be due to // = require jquery_ujs ...
0
votes
0answers
8 views

How to write a reference in a Rails html.erb file to execute javascript held in assets/javascript file

I want to move Javascript code out of my new.html.erb file in a Rails application to a separate file in the asset/javascript folder and have it execute when a form entry changes as I believe this is ...
0
votes
0answers
16 views

How do I Authenticate user before cucumber test?

I am trying to wrap my head around BDD using Cucumber (for feature tests) and RSpec (for Unit Tests). I am having trouble writing my first test for Cucumber. I need to authenticate first, but don't ...
0
votes
2answers
45 views

Rails 6: Only one profile per user should be created

I'm currently working on a Rails 6 application. I have the following association. A User has a Profile and a Profile belongs to a User. When editing a profile for a user I ended up having two profiles ...
0
votes
1answer
26 views

Rails model name lookup: strange uninitialized constant error

I have a controller that should output suggestions for a form. The controller is under the Admin::Shop namespace and is located at app/controllers/admin/shop/suggest_controller.rb class Admin::Shop::...
-1
votes
1answer
39 views

Using 'if', '&&', and '||' in one condition statement

So what I am trying to accomplish is if @provider.licenses.where(issuing_state:'CA')' it has to match the @form.state as well which would be 'CA' in this case in order to have access to that page. Now ...
-3
votes
1answer
30 views

How to check & set custom field value in redmine?

The problem: I am working on importing a CSV file to Users. And I want to create them a custom field "display order", and populate it if such custom field exists for model Users. What I've done to ...
0
votes
0answers
12 views

React + Material-UI style classes from different components conflict when served statically

Issue: styles applied to class names generated by Material-UI / JSS are incorrectly changing when components are re-rendered. Setup: I'm serving a React app (built with create-react-app) that uses ...
0
votes
1answer
12 views

Redis Subscription + Rails ActionController::Live han

In a single controller of a simple Rails 5 app, I have 2 actions (live and test), both using ActionController::Live. live goes through a loop and write random data to response.stream.write without any ...
0
votes
0answers
24 views

Kaminari pagination with AJAX, got stocked at “Page is loading..”

I found so many resources on Stackoverflow that faced the problem am facing but unfortunately, they didn't work for me and I certainly do not know what am missing. To point out some links I checked ...