Questions tagged [rom-sql]

rom-sql is a Ruby gem which allows SQL support for Ruby Object Mapper.

rom-sql is a gem which allows support for ROM ().

For further references, see the GitHub page.

5 questions
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
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…
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

Rom-sql Rake Task

I'm trying to setup migrations using 'rom/sql/rake_task'. Here is my sample, but sadly it isn't working as it's complaining about a missing sequel adaptor. Any assistance or direction would be appreciated? require 'sqlite3' require 'rom-sql' require…
Dane Balia
  • 5,271
  • 5
  • 32
  • 57
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