All Questions
Tagged with ruby ruby-on-rails-5
3,178
questions
0
votes
0
answers
89
views
Rails before_update not triggering on update but save works
Model looks like
class Campaign < ActiveRecord::Base
before_update :delete_triggers
def delete_triggers
Trigger.where(campaign_id: id).delete_all
end
end
and in the controller I do
...
0
votes
0
answers
91
views
When searching in Yandex mail with imap, i get an BACKEND SEARCH ERROR
I am trying to search emails from yandex using IMAP, but I get the error
Net::IMAP::NoResponseError: SEARCH Backend error. sc=jgeTdx5CdCg0_101156_imap-production-84
from /usr/local/lib/ruby/2.7.0/net/...
0
votes
2
answers
61
views
link_to redirecting instead of opening modal
I have 2 edit buttons in 2 different pages. One is working perfectly opening a modal to edit, the other one is redirecting to a page that doesn't exist. How can I fix that? I am using ruby on rails 5....
0
votes
1
answer
89
views
Rails 5 (from Rails 4.2) and Devise 4 (from Devise 3) Upgrade: Warden::Proxy Instance Not Found in Request Environment
So we’re in the process of upgrading an old Rails 4 app. We’re currently trying to jump from Rails 4.2 to 5.0. Part of this involves upgrading Devise from version 3 to version 4. We’ve been jumping ...
0
votes
0
answers
96
views
Rails 5.1 .any? and .exists? causes unknown column
I'm working with Rails and have encountered an issue with a model that references a table defined in schema.rb as:
create_table "test_table", primary_key: ["somthing", "...
0
votes
2
answers
145
views
Rails has_one association is saved even after the transaction is rollback [closed]
I am upgrading rails 3 app to rails 5 version. I have has_one and belongs_to association. I am saving records in transaction block. in rails 5 i have observed that in case if transaction is rollbacked ...
0
votes
3
answers
60
views
Set two keys for one value in Hash in Rails
Let's say I have a hash:
{
first: :value1,
second: :value1,
third: :value2
}
During .map I need to eliminate duplicates so it should be either first or second only. Is it possible to have some ...
0
votes
1
answer
35
views
Problem with conditional logic in Rails: instance method does not return expected value
I'm developing a Rails app that allows users to post. I want posts to be anonymous if the anon field in the database is set to 1. To implement this functionality, I added a method in my Post model ...
0
votes
1
answer
850
views
`rescue in retrieve_store_class': Could not find cache store adapter for dalli_store
Used versions below
rails 5.2.8
ruby 2.3.1
dalli 3.0.4
I receive the following error:
cache.rb:110:in `rescue in retrieve_store_class': Could not find cache store adapter for dalli_store (cannot ...
0
votes
1
answer
58
views
Rails: Truncating HTML-tagged text while preserving link text during truncation in a database column
I have a database column named comment that stores comments containing HTML tags.
To shorten large texts and display them fully in a pop-up, I'm using the truncate(comment, length: 50, escape: false) ...
0
votes
0
answers
24
views
How to utilize an index in PostgreSQL for a similar scenario where MySQL's "USE INDEX" is used [duplicate]
I have a Rails application where I'm currently using PostgreSQL as my database. In one of my methods, I have utilized the "USE INDEX" feature in MySQL to specify a specific index to be used ...
1
vote
1
answer
269
views
"Faraday::ConnectionFailed: Broken pipe" when uploading Tempfile to S3 Presigned URL
In my Ruby on Rails application, I need to upload large (~30MB or greater) MP4 video assets to an Amazon S3 Presigned URL using the Faraday Ruby gem. This operation frequently fails with a Faraday::...
0
votes
1
answer
77
views
How to write unit test/ mini test for a class which has self.method with few hardcoded class in that method( I am new at writing tests in ror)?
I have given a task to write unit test in rails for this particular class which was written back in 2017, but since i am new to this and the code stucture is so bad that i am not able to find best way ...
2
votes
0
answers
744
views
Adding flags when install gem via `bundle install`
I am trying to install mysql2 gem like below and this works
gem install mysql2 -- --with-cflags=\"-I/usr/local/opt/[email protected]/include\" --with-ldflags=\"-L/usr/local/opt/[email protected]/...
0
votes
0
answers
93
views
Rails 5 and Mysql2 gem issue
I am trying to upgrade a Rails 4 app to Rails 5, looks like all went well and also bundle install succeeds. however when I try to start up the server I see two errors in the below sequence
1. ...