2,093 questions
0
votes
0
answers
31
views
Mechanize not getting a site
while using Mechanize gem in rails and fetching the site https://www.reuters.com/ its giving -> Failed to fetch page:
401 => Net::HTTPUnauthorized for https://www.reuters.com/ -- WWW-...
1
vote
0
answers
58
views
Server restart is required when the page reloads due to the caching
We use the MemCachier addon in production for the Rails caching. Recently, we upgraded the Rails version from 5 to 6.1, and from that time onwards, we got one error in the local machine.
For example, ...
2
votes
1
answer
72
views
Multi DB Access In Rails 6 + Heroku
There is a Rails 5 application that runs in Heroku; it has two DBs, a Primary and a Follower (read-only), the follower is the replica of the Primary. In some application areas, we use followers to get ...
0
votes
1
answer
54
views
How to add associations for polymorphic join table
I have a polymorphic join table that I want to create using the following migration.
create_table :sourceables do |t|
t.string :object_type, null: false
t.bigint :object_id, null: ...
0
votes
0
answers
120
views
Problem with ActiveRecord-Session_store gem when starting up Rails 6 app
I'm upgrading a Rails app from v5 to v6.1.7 (ruby:2.7.7), but I have a problem with active_record_store for sessions at start up when running locally in Docker.
I've installed the 'activerecord-...
0
votes
0
answers
54
views
HABTM relationship / validates associated: valid? is true even though I don't think it is
I made the following join table to be used in a HABTM relationship between tasks and itself:
create_table :tasks_tasks, id: false do |t|
t.belongs_to(
:dropoff_task,
null: false,
...
0
votes
1
answer
189
views
Docker Compose, Rails 6, and Webpack Development Server for Development Environment
I am attempting to use webpack-dev-server with my Rails 6 application, and using the configuration below, I am getting some odd behavior.
When I change an asset file, the webpack container does run, ...
0
votes
1
answer
55
views
How does react process redirects?
I'm new to working with react and I think i have spent considerable time in researching about my issue/problem but no luck. I have a react FE and a rails BE. The FE is just a login page with a couple ...
1
vote
0
answers
49
views
Rails globalize error undefined method `translates' for Post:Class
I am using rails 6.1.4 and added transalations table to post via this migration
class TransalatePosts < ActiveRecord::Migration[6.1]
def change
def self.up
Post.create_translation_table!...
0
votes
0
answers
103
views
Rails 5 -> 6 upgrade, deprecation warning from zeitwerk:check
Anyone game to dredge up memories of your Rails 5 -> 6 upgrade?
I’m running bin/rails zeitwerk:check and while it is, at the end, telling me All is good! I do get a pretty big deprecation warning:
...
0
votes
1
answer
140
views
Rails lockbox and blind index, unable to access encrypted field
I have lockbox v1.3.3 / blind index v2.3.2 gems installed (have to use this version, can't upgrade at the moment).
I am using rails 6.0.3.2 and ruby 2.6.9.
I followed these steps:
https://ankane.org/...
1
vote
2
answers
279
views
override belongs_to association in subclass
class Post < ActiveRecord::Base
belongs_to :user
end
class ExtraPost < Post
belongs_to :user, optional: true
end
Rails 6.1
When creating an instance of the ExtraPost class, an error occurs ...
0
votes
1
answer
115
views
invitation_accepted? returns FALSE in after_invitation_accepted CALLBACK
I use devise_invitable (2.0.6)
invitation_accepted? returns FALSE in after_invitation_accepted CALLBACK but when I pause here and check in rails console it gives me true for invitation_accepted?
user....
0
votes
1
answer
635
views
Unknown Syntax Error: Invalid option name ("--production=false") in Heroku deploy of rails app
I have a rails project (rails 6.1 & ruby 3.1.2) which I have deployed to heroku in the past, but now I'm encountering a problem with Heroku. I get the following error:
Counting objects: 80, done.
...
1
vote
0
answers
97
views
Rails 6 - <%= link_to %> Is Not Opening Modal to Confirm Deletion and Just Deleting, How to Ensure Confirmation Before Deletion?
I'm currently facing a problem in my project. I'm on Rails 6.0.4.8 and Ruby 2.6.8.
The issue I'm running into is that I would like a user to be able to delete a notes record by clicking on an icon but ...
0
votes
1
answer
179
views
Flash messages missing in a server rendered page
I have a Rails 6 app (migrated from Rails 5 a while ago) which manages Items and an Overview of those Items. When you update an Item you're redirected to it's Overview.
Therefore in my Items ...
0
votes
1
answer
71
views
ActionController::ParameterMissing in StaticPagesController#contact (Ruby on Rails 6)
How to solve this missing params?
StaticPagesController:
class StaticPagesController < ApplicationController
def home
end
def about
@hero_title = 'about_us'
end
def services
@...
0
votes
0
answers
53
views
jquery issue in Rails 6 project
I have facing issues of jquery in my rails 6 project. I've attached the picture of my errors enter image description here
Ruby version is 2.7.6 and Rails version is 6.1.3. And I'm using asset pipeline ...
1
vote
1
answer
137
views
Rails | Use Nested Attribute as Foreign Type For Polymorphic Association?
In Rails, I would like to structure my models such that the main record (lets call it Shipment) has a detail record (base type: ShipmentDetail) that is polymorphic such that the structure of the data ...
2
votes
3
answers
351
views
Understanding Ruby Versioning Conflicts: Unraveling the Net::ProtocRetryError and Net::BufferedIO::BUFSIZE Warnings
Every time i'm working when i try to launch any gem like mailcatcher, start my server or run the command rails c i see this error message and i don't know why it's look like some kind of error ...
0
votes
1
answer
95
views
log error with passenger in rails 6 app : set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable
I have a rails 6 app, working fine, using passenger with nginx, but there is log error like this :
App 759213 output: [passenger_native_support.so] trying to compile for the current user (www-data) ...
0
votes
0
answers
20
views
Rails Capybara XPath Feature Spec Not Seeing My Image
I'm using rails 6.1, ruby 3.1.1 with capybara
I'm learning feature specs and I've never used xpath before. I have a page/view with several images that I'd like to have tests for - to be sure they are ...
0
votes
1
answer
62
views
My Rails Controller Spec is Not Passing When a Redirect Happens
I'm using rails 6 and ruby 3.1.1 and Rspec
It's been a minute since I've written tests, so the syntax is a bit new to me, but "I think" I understand it. A controller create test is not ...
0
votes
0
answers
32
views
In Rails how do I swap images using the image_tag and JQuery
I'm using rails 6 and ruby 3.1.1 My app is running on Heroku.
I have two images: plus.png, which is a + symbol and minus.png, a - symbol. Both are in assets/images.
When my view loads, the + image ...
1
vote
1
answer
546
views
wrong number of arguments (given 2, expected 1) in Rails
module ApplicationHelper
def t(*a)
translate(*a)
end
end
Case 1 :- t('views.home.welcome_updated', default: 'Updated') => Getting Error: (wrong number of arguments (given 2, expected 1))
...
0
votes
1
answer
47
views
Why is Link in Rails Mailer Email Showing Incorrectly?
'Rails 6.1', 'ruby 3.1.1'
This is the first time I've added a link in an html email sent via a rails mailer. The email works, it's sent (to me) and I can see it. But the hyperlink in it is showing ...
1
vote
0
answers
54
views
Rails option_for_select how to show a combination of two-fields of hash in drop-down
rails 6.1, ruby 3.1.1
On a form (form_for) I have a drop-down select box using options_for_select in my :sort_order field. It takes a hash and is currently showing colors as the options text, which ...
1
vote
0
answers
183
views
Flipper: Is it possible to get a timestamp for the most recent change to a feature?
Using Flipper (0.28.3) in Rails I want a way to detect when the most recent change to a feature. I want to do this so I can use it as part of a cache key to invalidate view caches whenever a change is ...
1
vote
2
answers
299
views
js requests to Rails 6.0 app render html template instead of js
I'm in the process of migrating a legacy Rails 5.0 app to (hopefully) 7.x. I got to 5.2.x without too much trouble. I'm currently trying to upgrade to 6.0 and I have a problem with controller actions ...
0
votes
0
answers
34
views
Not Displaying Image with Carrierwave using Rails 6
I was looking for a way to upload photos to the database and display images on a page. I am using Carrierwave. The image uploads correctly, but when it goes to display, it will not. When I tried to ...
0
votes
2
answers
56
views
Stripe plan update URI::InvalidURIError
I create an update method based on the creation, the only difference is in changing the stripe method, but unfortunately I get an error, although the logic is identical
update_feature_plans_job.rb
...
1
vote
1
answer
28
views
Rails Delete not working in namespacing with the Confirm Are You Sure
I'm using rails 6.1.4 and ruby 3.1.1
In my app I have a students model in a sub-directory: living_muay_thai/students. I'm having problems trying to figure out how to delete students with the link_to ...
0
votes
0
answers
21
views
can't add gem "devise" to ruby on rails 6 project [duplicate]
When I included gem devise in my project and wrote the bundle install command to the console, in order to install all the gems in my project, I got the following error:
An error occurred while ...
-1
votes
2
answers
335
views
stripe does not create a subscription
I'm creating a regular subscription service. Everyone can offer their service and subscribe to it.
but the subscription is not being created
errStripe::PermissionError (The provided key 'sk_test_******...
1
vote
1
answer
189
views
Rails 6 | Mass Attribute Assignment Without Protection?
I am attempting to work-around a performance issue with a 3rd party library (acts_as_taggable_on). For the one model that uses this extension, it has a N+1 Query problem where it will make one or more ...
0
votes
1
answer
315
views
Is there a way in Rails 6.X to read secret_key_base from an environment variable in production?
I have SECRET_KEY_BASE set up as an environment variable in production and everywhere I need it in my code, I read it from the environment. But when I try to deploy, during asset recompilation, I get:
...
2
votes
0
answers
1k
views
No unique index found for id
I have faced an error "No unique index found for id" while trying to use Upsert all. But isn't ID a unique index by default? Initially we have created our application in rails 3 and now we ...
1
vote
1
answer
79
views
Rails 6 Bootstrap 5 Ajax Call loading all user_notes instead of just current_user's notes
I have a joined table called user_notes, which joins an adventure_id with a user_id (belongs_to) and has a single longtext field, :note. The problem is that upon loading the page and also with ...
1
vote
2
answers
1k
views
Rails ActiveRecord::LogSubscriber not outputting verbose query logs
I'm trying to enable verbose query logging in Rails, but the ActiveRecord::LogSubscriber is behaving oddly, which is causing the verbose query logging to not work.
The issue seems to be originating ...
0
votes
1
answer
134
views
create mysql functions or stored procedure from a rake task
I'm trying to create functions and stored procedures inside RoR project MySql database, these objects are needed for me to import historic data from the old platform the customer is actually running......
0
votes
1
answer
36
views
Reusing same models and its set of associations based on selected timestamp
In Rails 6 application focusing on school management system, I am looking for a way by which a structure created by any school can be reused again, for every academic year.
Xaviers School - academic ...
0
votes
0
answers
67
views
Rails 6: "Unable to autoload constant" error with POST request to nested controller
Description:
I'm using Rails 6 for my application, and I've encountered an issue when making a POST request to a nested controller. Specifically, when I try to submit a POST request to localhost:3000/...
1
vote
1
answer
612
views
Why is Rails ActionCable available without mounting
I would like to use action cable in my rails 6 application with the ruby_graphql gem.
I have noticed that when I simply add
require "action_cable/engine" to my application.rb
and the ...
1
vote
3
answers
260
views
Rails rescue_from handler function is getting called in the end
I have a Rails 6 application.
class PostsController
rescue_from MyException, :handle_my_exception
around_action :my_around_action
def create
Rails.logger.info "Executing create code&...
0
votes
1
answer
338
views
Convert a returning Hash of a Model's method to a serializable_hash (for as_json)
My Modelclass has a method, that returns some calculated data in form of a Hash. In the Controller I want to use this data, but want to include only some parts of the Hash.
My first idea was, to use ...
0
votes
1
answer
361
views
Search Products by Tags in Shopify via GraphQL in Rails
I am using rails Shopify API and using Storefront API to get the products from Shopify. We have a lot of tags applied on every product. I want to get all the products that include the tags, either &...
3
votes
0
answers
230
views
Sorbet type-checking freezes in my Rails 6 project with latest sorbet and tapioca versions
We have a Rails 6 project and running into problems getting Sorbet typechecking to work. We have been following the adoption guide and getting stuck at Step 3 with no debug output or errors.
These are ...
1
vote
1
answer
46
views
Active_scaffold record created message : Created #<Docket:0x0000013800ec4df0>
I'm using Rails 6.1.7 and active_scaffold latest version with a very basic tutorial one model app, I get this message on the form top when a record is created:
Created #<Docket:0x0000013800ec4df0&...
1
vote
2
answers
2k
views
ArgumentError (wrong number of arguments (given 1, expected 0)) After Upgrading to Ruby on Rails 6.1
I'm upgrading my open-source Ruby on Rails app from Rails 6.0.x to Rails 6.1.x
The upgrade went fine, except now I get an error from an async ActiveJob that fetches RSS feeds. When my app is deployed ...
0
votes
1
answer
1k
views
How to keep data synced between development and production databases?
Update:
People have raised some good questions about my site and workload so I thought some addition information would be helpful.
My site has 1200+ plants in a garden, with multiple tables and dozens ...