Skip to main content

All Questions

0 votes
1 answer
72 views

Rails 7: Psql trying to connect to the wrong database but trying to create correct database

In production mode, I am testing connecting a rails 7 project to a remote server for the postgresql database. However when I try to connect to it, it starts looking to connect to the postgres database ...
Ese10's user avatar
  • 19
-1 votes
1 answer
75 views

Rspec on Docker with database_cleaner causes remote URL error: RemoteDatabaseUrl

I'm working in Docker, trying to run bundle exec rspec ./spec/services/something/something_spec.rb and I am getting this error DatabaseCleaner::Safeguard::Error::RemoteDatabaseUrl: ENV['DATABASE_URL'] ...
Jose Paez's user avatar
  • 779
0 votes
1 answer
33 views

rollback database in local doesn't update postgres in server Rails 7

I'm running Rails 7 on my server, even though when I add a new table, it does migrate and I can see it in the server database. But when I made changes by rolling back in development environment, and ...
John Sall's user avatar
  • 1,107
1 vote
0 answers
98 views

Getting randomly PG::Error: can't open large object with rails application

I have a rails application using postgresql 16, i am using latest version 1.5.6 of pg gem. I have the below method:- def file_length transaction do lo = active_connection.lo_open(self.oid, ...
Sachin Singh's user avatar
  • 7,167
1 vote
0 answers
86 views

Rails: When adding a new enum column to my Postgres DB, why do I have to use change_table (not add_column) in my migration? And is it equally safe?

All the examples of adding a new enum column, which Rails 7 supports, require a change_table to add the column, like: def up create_enum :status, ["draft", "published", "...
melanie's user avatar
  • 627
0 votes
1 answer
38 views

Rails query working in console but not in the controller

I have an application that has a table Doctors with a name field. The users can put any version of the name in there they want. I'm trying to sort the records based on last name(last word in the ...
Robert Reynolds's user avatar
0 votes
1 answer
104 views

How to query in Rails jsonb boolean attribute in postgres database?

In Rails 7, I do have following Council model with settings JSONb hash. I want to get all Councils where innov_funnel_connected: true in settings jsonb column. # == Schema Information # # Table name: ...
tomekfranek's user avatar
  • 6,999
1 vote
2 answers
262 views

How can I override PostgreSQL's gen_random_uuid() in Rails?

I want to prepend a string to the uuid generated by PostgreSQL's gen_random_uuid() to use as the uuid for one of my models (it won't be the primary key). Think like Stripe's price and customer ids - &...
supersaidso's user avatar
1 vote
1 answer
409 views

How to use Postgresql's "real" (float4) type in Rails 7.0, instead of the "double precision"?

I've got a Rails 7.0 app connected to a Postgres Database. I've got tables with several millions of rows, and each row storing more than 10 columns as float types. The default way of storing numbers ...
Slth's user avatar
  • 173
1 vote
0 answers
66 views

SyntaxError: Unexpected end of JSON input after Delete request Rails7/React

I am building a basic React application utilizing a Rails api for school. Its a videogame review website. The application is properly rendering my reviews and each of their respective delete buttons....
Samity's user avatar
  • 11
1 vote
1 answer
127 views

Rails 7 - Accessing joined model generate new query

I have Rails 7 project where I've got tables Pipelines class Pipeline < ApplicationRecord has_many :states, inverse_of: :pipeline, dependent: :destroy end States class State < ...
m1l05z's user avatar
  • 378
0 votes
1 answer
236 views

Stripe::InvalidRequestError in CheckoutController#create

I am new to Ruby on Rails and I am getting the following error, You cannot use line_items.amount, line_items.currency, line_items.name, line_items.description, or line_items.images in this API version....
user21515097's user avatar
0 votes
1 answer
36 views

Advice needed on table architecture for storing information about external integration in a Ruby on Rails API application with postgresql

How can I design a database for storing custom integrations for each client in an application where different clients can have integrations with different services (e.g. ATS, HRIS), the catch is ...
Pran's user avatar
  • 1
0 votes
0 answers
856 views

How can I bulk insert records with UUID primary keys using insert_all in Rails?

I have a controller action which, upon creation of a parent object, generates and saves a batch of M-M associations. The database is Postgres and all relevant tables in the application use UUIDs. When ...
R. Barrett's user avatar
0 votes
0 answers
189 views

Rails active record seems out of sync with postgres

I am using rails 7 and postgres 14.5 and active record now seems out of sync with postgres. I saved a user and I got ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR: duplicate key value ...
monty_lennie's user avatar
  • 3,171

15 30 50 per page