Questions tagged [ruby-on-rails-5.2]

For issues specific to the version 5.2 of Rails. If your question applies to Ruby on Rails in general, use the tag [ruby-on-rails].

0
votes
0answers
14 views

How to get the exact path of each element using map

I want to join the categories and locations tables which both have a many to many relationship and I want to create links to each location item which is map to that particular category. The code below ...
1
vote
0answers
9 views

Changing attribute_changed? to save_changed_attribute? in after_save creates rspec timing issue

I am upgrading from Rails 5.1 to 5.2. I made the recommended update for the dirty attributes API change, and now I have a timing issue in my specs where I need to put a sleep at the end of the setup ...
0
votes
0answers
36 views

Why is the field name incorrect?

I have a form in which a grouped select list. = f.grouped_collection_select :category_id, Category.all, :categories, :title, :id, :title, { label: 'Category', prompt: '---' } The form is wrapped in ...
0
votes
0answers
14 views

NoMethodError in Controller, undefined error is not found anywhere in my code

I have a course model and controller with some attributes including an image which i previously uploaded using carrierwave and it was working good then i wanted to implement ActiveStorage to store the ...
1
vote
0answers
20 views

How to deploy & configure thinking sphnix on production server

i have tried install & configure thinking sphinx on local host & its working fine. When i tried to install on production server i am confuse with how to configure thinking sphinx on server. ...
0
votes
0answers
9 views

How to implement dynamically multiple SSL Certificates on One IP with Nginx by taking user input from rails application on Ubuntu 18.04

I want to take ssl credentials as input from users then based on the credential his/her domain will ssl included.
0
votes
1answer
30 views

Rails 5.2 and Sidekiq 5: Errno::EADDRNOTAVAIL: Cannot assign requested address - connect(2) for “localhost” port 25

I'm trying to deliver e-mails with Sidekiq and deliver_later. In my config/sidekiq.yml I have: :verbose: true :concurrency: 25 :queues: - [mailers, 7] - [critical, 6] - [default, 5] - [low, ...
0
votes
1answer
4 views

Etags in Rails 5 with Phusion/Apache 2.4

When using fresh_when strong_etag: @collection in a Rails view, the etag is generated before being gzipped by Apache, thus it lacks the "-gzip" suffix. However, if Apache is set to gzip responses, ...
0
votes
0answers
28 views

ActiveRecord - Associations 2 level down are not being saved

I have the following models class Poll < ApplicationRecord has_many :options, dependent: :destroy has_many :votes, through: :options accepts_nested_attributes_for :options end class ...
1
vote
1answer
15 views

Invalid configuration object when starting webpack-dev-server

I've just installed webpacker on my Rails 5.2 application and when trying to run bin/webpack-dev-server I get the following error: ✖ 「wds」: Invalid configuration object. Webpack has been ...
1
vote
0answers
12 views

Append secrets to credentials.yml.enc programatically

Is there a way to programmatically add secrets to config/credentials.yml.enc in Rails 5.2? Pushing the credentials.yml.enc to the repository for internal use may be fine, but as soon as the app is ...
0
votes
1answer
20 views

Passing parameter to days.ago (Rails 5)

I have the following method and I am using 5.days.ago method in rails. It feels funny to do what I am doing since I am calling days.ago on the object days_posting_delayed. Is there a better method I ...
0
votes
1answer
20 views

ERROR: operator does not exist: timestamp without time zone > integer)

I am using Rails 5.2 and passing a date parameter. To simplify my example, look at the below sql query, it is similar but simplified as it is too complex to be used with active record methods, so I ...
1
vote
1answer
22 views

Does Rails 5.2 API mode swallow default security headers?

If I output config.action_dispatch.default_headers in my application.rb I see all the standard rails headers: {"X-Frame-Options"=>"SAMEORIGIN", "X-XSS-Protection"=>"1; mode=block", "X-Content-...
0
votes
2answers
25 views

How to fix activeuuid gem error while upgrading from Rails4 to Rails5

I am updating my application from rails 4 to rails 5. My application is using activeuuid gem. The activeuuid gem is using alias_method_chain internally and this method is deprecated in rails 5. Now ...
0
votes
0answers
11 views

Messages show up only after refreshing the page

I'm building this chat app and when I type in a message, press enter, I can see in the console that the message is created and it also prints out this: No template found for RoomMessagesController#...
0
votes
0answers
42 views

Why does `Rails.application.credentials.api_key` return `nil` in my Rails 5.2 app?

I'm trying to add a key for an external api I am using by editing my config/credentials.yml.enc file. I run the command EDITOR="subl --wait" rails credentials:edit in the command line to open the file ...
0
votes
1answer
16 views

How to serialize virtual attributes in rails 5

I want to searilaize a couple of virtual attribute defined in my model like below class User attribute :full_name, :string attribute :mobile, :integer serialize :properties end I wants to ...
0
votes
1answer
9 views

How to update an attribute after create or update

I’m new to rails and I’m trying to figure out the following. I’ve got a class Order which has attributes name, status and radius. The possible status are [draft, posted, taken]. The radius can ...
0
votes
1answer
14 views

Rails 5 cross model ajax form not updating index

Class Actual is managing the creation and deletion of objects in class Friendgroup. The form page <ul id=friendgroups> <%= render @friendgroups %> </ul> <%= form_with model: ...
0
votes
0answers
14 views

Caveats involving transactions for multithreaded rails applictions that can prevent data being saved

I've encountered an issue that seems like it might be related to nested transactions, to try and remove the idea that it might be some oddity involving transactions that I'm unaware of I would like to ...
0
votes
0answers
12 views

Rails 5: undefined method `megabytes' for 64:Integer when using in config/environment/staging.rb

As explained in Caching with Rails Guide I added the following line to config/environment/staging.rb: Rails.application.configure do ... config.cache_store = :memory_store, { size: 64.megabytes } .....
0
votes
0answers
15 views

How do I fix the Net::OpenTimeout issue when sending emails?

I am working with ruby on rails 5.2 using the actionmailer and it is currently throwing execution expired whenever I try to send emails out. On Rails 3.2 this actually worked but there is some change ...
0
votes
2answers
23 views

Rails - How do I change my custom methods in a controller to conventional methods?

I have a Subscribers Controller with custom methods like add_subscribers, add_subscriber and remove_subscriber. How to I change these methods to using the conventional create and destroy methods to ...
0
votes
1answer
16 views

How to set up AWS ElastiCache cluster in Rails? (problem with the MOVED response)

I am using: rails (5.2.2) redis (4.1.0) And I have a Elasticache cluster in AWS. AWS gave me a self-discoverable DNS record: $ dig ec-cluster-test.44cbxh.clustercfg.euw1.cache.amazonaws.com ; &...
0
votes
0answers
9 views

JRuby Rails 5.2 credentials AUTOMATION

I need to be able to install our app via a war file and automatically generate a master key and the credentials.yml.enc file. There SHOULD just be a way to specify the secret and master key and have ...
0
votes
0answers
40 views

Model has_many of anothe model ( Set of predefind values )

I have two models, Rating & RatingReason, RatingReason will contain a list of static values that may increase with time. class Rating < ApplicationRecord has_many :rating_reasons end class ...
0
votes
1answer
22 views

Calling a Associated Controller Method Not Working

I have 3 models of User, Role and UserRole with their respective controllers as UsersController, RolesController and UserRolesController. I have a method in the UserRoles controller which I would ...
0
votes
1answer
44 views

How to debug a webpacker CSS loading issue in a react component?

I've got a rails app with increasing amounts of react on the front-end (using the react-rails and webpacker gems). I'm in the process of moving away from JQuery-mobile look and feel. I am trying to ...
0
votes
0answers
27 views

Show the associated model object fields

I have a model Organisation. This model has_many organisation_branches. The organisation_branch has the address details in which the city_id is present, which refers to the city table. organisation....
0
votes
1answer
37 views

Fix inconsistent route names (Rails)

Routes resources :favorites, only: [ :index, :create, :destroy ] , param: :listing_id Rake routes favorites GET /favorites(.:format) favorites#index favorites POST /favorites(.:...
0
votes
1answer
56 views

How to fix Rails 5.2 application bundler issue for AWS Elastic Beanstalk deployment

I am trying to deploy Rails 5.2 application to AWS Elastic Beanstalk, but I am getting this error. Creating application version archive "app-c6b5-190405_225348". Uploading example-rails52/app-c6b5-...
1
vote
2answers
41 views

#= require not working after upgrade to Rails 5

I upgraded Rails 4.2.10 application to Rails 5. Solved errors with bundling and some deprecations. I am able to start the Rails Application, but when I try to load the Application, it fails with error,...
2
votes
1answer
64 views

Use a single form_with to create and edit nested resources in Rails

Background Inside of my application, a series is composed of many books. A series' Show page allows a user to see all the books in a series and to add a new book to the series using a form. Every ...
0
votes
1answer
22 views

How to make dependent records inactive but not destroy using concern

I have a model named runningmenu i want to inactive it on destroy but not hard delete, and also i want to inactive all its dependent records e.g orders i am using ruby 2.4.0 and rails 5 i have tried ...
0
votes
1answer
45 views

Capybara fails with NotSupportedByDriverError

I'm trying to verify download csv works in my rails application. But its throwing the error Capybara::NotSupportedByDriverError: Capybara::Driver::Base#response_headers it 'exports as CSV' do ...
0
votes
0answers
9 views

Taking too long to to exit rails console

My rails console opens up quickly, but when I exit, it takes a full minute to complete. What could be causing this? Should I reinstall rails? I've rebooted my computer and restarted rails, but neither ...
1
vote
2answers
56 views

How do I edit an old Rails migration to add a reference?

Preface I know I could create a new migration, but I want to know if it is possible to edit an existing one in this way. This is just me learning Rails and trying out new things. There is no ...
1
vote
0answers
26 views

Puma not creating socket “pumactl.sock” at defined location when deploy mina rails

I am deploying my source using mina deploy but puma server is not starting and pumactl.sock this file is not created. deploy.rb require 'mina/bundler' require 'mina/puma' require 'mina/rails' ...
0
votes
0answers
33 views

Rails joins producing unexpected results

Relationship Structure User--> Favorite User --> Profile --> Activity -->Favorite --> Hobby --> Address Relationships User has_one Profile ...
0
votes
1answer
26 views

Autofocus not working after updating form with ajax

In Rails 5.2 I created a form (my first) with the form_with helper. By default this is remote: true. This form contains one input with autofocus="autofocus". After a validation error the same form ...
0
votes
1answer
34 views

Rails.fire unable to submit form

I want to submit a remote form using JS and I am using Rails 5.2.0. The form looks like below: <form class="new_post" id="my_form" action="/posts" accept-charset="UTF-8" data-remote="true" method=...
1
vote
1answer
16 views

Gem Carrierwave is not allowing application/octet-stream file to upload

using Rails 5.2, ruby 2.4 gem carrierwave gem 'carrierwave', '~> 1.0' when I upload with extension mdl and content type: application/octet-stream It return on file save the following error ...
1
vote
1answer
58 views

Force WSO2 to login with google every time

I have a Rails application and I have configured WSO2is with Oauth 2.0 with it to login with Google. It works fine. But there is an issue with it. Example suppose I log in with one of my Google ...
0
votes
1answer
38 views

Rails: Using same name of Table field for Model method. Can this work?

Say I have a Users table with a first_name field. Automatically I have a User model. What I wan't is to know if it is possible to make a method also named first_name in the User model work? I might ...
7
votes
1answer
97 views

How do I specify an ability for a route created by a Rails engine?

I am using Trestle Admin, this is my route: trestle_path /admin Trestle::Engine When a user that is not an admin visits the /admin route, I would like CanCanCan to handle it like it ...
0
votes
2answers
65 views

Rails 5.2: How to create fields_for each I18n key value?

In my _form.html.erb I have nested fields, where for an Offer I would like to save multiple Discount types with values: <%= f.fields_for @offer.discounts do |discount| %> <% I18n.t(:...
0
votes
0answers
38 views

Rails 5: Saving external API call to DB

I'm currently trying to save filled out forms from my Typeform. Everything works just fine, except when I try to save the form to the db. My model Order.rb class Order < ApplicationRecord ...
0
votes
0answers
34 views

What works on rails console doesn't work in the enviroment

I am working with STI in my rails project. I have a model, say Person, which has many (for example) Child. I then what to use STI on the Person model, like class Person < AR::Base has_many :...
0
votes
0answers
17 views

Webhook POST causing ActionDispatch::Http::Parameters::ParseError

I have a Rails 5.2.x app that integrates with Microsoft Dynamics Business Central. It's possible to create "subscriptions" on Business Central that interact with a web hook on the Rails app when an ...

http://mssss.yulina-kosm.ru