Tag for questions related to Ruby Object Mapper project
Questions tagged [rom-rb]
13 questions
                    
                    2
                    
            votes
                
                0 answers
            
        Inclusion filtering in postgresql on a enum type column
I have a postgres enum create_enum(:status_type, %i[requested approved]). 
I created a column in a table with a status_type :status, null: false. 
I am trying to filter with inclusion on it in ruby like this:…
        
        geoko93
        
- 45
 - 12
 
                    2
                    
            votes
                
                1 answer
            
        Setting up rom-http relation for REST CRUD
I'm trying to set up a rom-http relation for basic REST CRUD, but I find the documentation to be pretty scarce for a beginner, and a little too complex when digging in. What I've tried so far is this:
rom = ROM.container(:http, uri:…
        
        wiz
        
- 606
 - 5
 - 9
 
                    2
                    
            votes
                
                1 answer
            
        How to query records with rom-sql by json column in postgres?
Having a table with jsonb column containing some array,
what is best way to select records containing specific tag with rom-sql?
Example of query.
https://www.db-fiddle.com/f/u4CFkUUpnHZj67j1RJ5YRe/0
CREATE TABLE posts (
  id INT,
  tags…
        
        cutalion
        
- 4,334
 - 1
 - 38
 - 47
 
                    2
                    
            votes
                
                1 answer
            
        How to enable query logger in rom-sql (rom-rb)?
In rom-sql I want to enable logging, so that I can see all the sql queries that are produced.
How can I achieve that?
Because it uses sequel underneath, I guest it may be somehow possible through sequel logger.
        
        maicher
        
- 2,625
 - 2
 - 16
 - 27
 
                    2
                    
            votes
                
                1 answer
            
        How to configure puma to establish rom-rb database connection?
If I were using ActiveRecord, my puma config would establish the database connection as described in Heroku's guide Deploying Rails Applications with the Puma Web Server.
on_worker_boot do
  ActiveRecord::Base.establish_connection
end
However, I am…
        
        Jared Beck
        
- 16,796
 - 9
 - 72
 - 97
 
                    1
                    
            vote
                
                0 answers
            
        Using ROM-SQL or Sequel, how can I query for multiple records using multiple columns (with different values per row)?
Given a database table with these three rows:
first_name
last_name
John
Doe
Will
Smith
John
Smith
Note: I specifically left out the id here because we might be dealing with a case where either we don't have the id or maybe…
        
        Kenneth Teh
        
- 31
 - 4
 
                    1
                    
            vote
                
                1 answer
            
        Use a postgres computed value without a column as a Ruby variable
I have a Hanami web application where one feature is to compare strings in the database with a user provided string. To do this, I use the postgres extension pg_trgm. The translated query condition in Ruby looks like this:
.where…
        
        Sebastjan Hribar
        
- 396
 - 3
 - 13
 
                    1
                    
            vote
                
                1 answer
            
        How to pluck aliased column from joined tables in rom-sql?
I cannot find how to pluck aliased column using rom-sql.
Given relations users and avatars (user has many avatars).
# works
users.join(:avatars).select { |r| r.avatars[:id] }.pluck(:id)
# does not work
users.join(:avatars).select { |r|…
        
        cutalion
        
- 4,334
 - 1
 - 38
 - 47
 
                    1
                    
            vote
                
                2 answers
            
        Using Hanami model and rake tasks without a router etc
I'm going to write a service that will using amqp protocol, without http at all. I like hanami's paradigm of repository-entity-model-interactors and I wonder to use those in my project. Generating all that stuff by hand, sure, is boring.
So, I…
        
        Dimitri
        
- 623
 - 7
 - 14
 
                    1
                    
            vote
                
                1 answer
            
        null validation failed when attribute supplied rom-rb
I'm trying to get to grips with the rom-rb persistence library, using sqlite3.
I ran the following migration, which includes a NOT NULL constraint:
ROM::SQL.migration do
  change do
    create_table :users do
      primary_key :id
      column…
        
        rwold
        
- 2,216
 - 1
 - 14
 - 22
 
                    0
                    
            votes
                
                2 answers
            
        How to construct TSTZRANGE in rom-sql?
I can't find how to write this query in rom-sql. Is it possible to add plain sql to where?
It looks for announcements which do not intersect with requests.
announcements.when and requests.when are tstzrange columns in postgres.
SELECT…
        
        cutalion
        
- 4,334
 - 1
 - 38
 - 47
 
                    0
                    
            votes
                
                1 answer
            
        Performance issue with a really big IN (ids) statement
I have this statement:  
select qulified_name
from table
inner join references_table on references_table.id = table.ref_id
where references_table.type = 'x' and table.value in (... +110 000 ids)
which is extremly slow. (The web app crashes and…
        
        Shimu
        
- 1,137
 - 11
 - 25
 
                    0
                    
            votes
                
                1 answer
            
        rom-rb form validation when using multiple relations
I'm trying out http://rom-rb.org/ and can't figure out how to get a presence validation to pass in the presence of multiple source models. I would expect the following script to save a new event and organiser, but instead it says that event_name is…
        
        Xavier Shay
        
- 4,067
 - 1
 - 30
 - 54