Questions related to the Ruby Object Mapper project
Questions tagged [ruby-object-mapper]
9 questions
2
votes
2 answers
How to fetch data from multiple tables with one SQL query in Hanami?
I have Hanami models User and UserInfo that have has_one association.
Repositories look the following:
class UserInfoRepository < Hanami::Repository
end
class UserRepository < Hanami::Repository
associations do
has_one :user_info
…

Sergey Potapov
- 3,819
- 3
- 27
- 46
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
Joining relations with Ruby Object Mapper
I have a little "just for fun" Rails app that I am migrating from Active Record and SQLite to Ruby Object Mapper. This is mostly a chance for me to explore the way that the data mapper pattern affects my code.
I have a Course model, a Game model and…

mmmries
- 967
- 8
- 12
1
vote
1 answer
Ruby Object Mapper - How to change the default order field in a Create command?
I am current working on a project that I want to use Ruby Object Mapper with an existing sql database. I am running into a problem when I execute a create command, the returned result seems to sort by table_name.id by default. This is a problem…

Edward
- 1,914
- 13
- 26
1
vote
1 answer
What is the correct way to use UTF-8 characters with PostgreSQL and Ruby Object Mapper?
I've tried many random shots in the dark, such as:
config.gateways[:default] = [:sql, database_url, encoding: 'UTF8']
And all variations on UTF8, e.g., utf8, utf-8, unicode, Unicode.
I've tried setting the shell env's LC_CTYPE to UTF8.
I've…

Yuri Gadow
- 1,814
- 2
- 16
- 26
1
vote
1 answer
How to Join Through a Join Table in Ruby Object Mapper SQL
Given a foo table, a bar table, and a foos_bars table, all three with id columns, the approach to getting bars with foos that the documentation would seem to imply is something like:
class Foo < ROM::Relation[:sql]
def with_foos_bars
…

Yuri Gadow
- 1,814
- 2
- 16
- 26
0
votes
0 answers
Ruby Object Mapper commands not recognized
I am learning Sinatra and Rom. I forked the dusty sinatra-rom project on GitHub.
I run the program with bundle exec rackup.
This issue has me stumped:
db/commands/products/create.rb throws undefined method relation for CreateProduct:Class…

Mike Slinn
- 7,705
- 5
- 51
- 85
0
votes
1 answer
How to Map A Many to Many Join in Ruby Object Mapper
Given:
create_table(:foos) do
primary_key(:id)
String(:name)
end
create_table(:bars) do
primary_key(:id)
String(:name)
end
create_table(:foos_bars) do
primary_key(:id)
foreign_key(:foo_id, :foos)
foreign_key(:bar_id, :bars)
…

Yuri Gadow
- 1,814
- 2
- 16
- 26
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