Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 05 05:40
    dependabot[bot] labeled #348
  • Dec 05 05:40
    dependabot[bot] labeled #348
  • Dec 05 05:40

    dependabot[bot] on npm_and_yarn

    Bump decode-uri-component from … (compare)

  • Dec 05 05:40
    dependabot[bot] opened #348
  • Nov 27 05:01
    boticello starred rom-rb/rom-sql
  • Nov 25 01:39
  • Nov 24 04:05
    hartca starred rom-rb/rom-sql
  • Nov 22 19:35
    gwilczynski starred rom-rb/rom-sql
  • Nov 22 16:10

    flash-gordon on release-3.6

    Update changelog (compare)

  • Nov 22 16:06

    flash-gordon on v3.6.1

    (compare)

  • Nov 22 16:06

    rom-bot on main

    Update CHANGELOG.md (compare)

  • Nov 22 16:05

    flash-gordon on main

    Update changelog (compare)

  • Nov 22 16:04

    flash-gordon on release-3.6

    Update changelog Update changelog (compare)

  • Nov 22 16:02

    flash-gordon on release-3.6

    Bump version to 3.6.1 (compare)

  • Nov 22 15:53

    flash-gordon on main

    Fix merge conflicts (compare)

  • Nov 22 15:48

    flash-gordon on main

    Revert "Use released dry-transf… (compare)

  • Nov 22 15:44

    flash-gordon on main

    Use released dry-transformer (compare)

  • Nov 22 15:38

    flash-gordon on main

    Fix mapping of PG cidr values t… (compare)

  • Nov 22 15:28

    flash-gordon on fix-cidr-mapping

    (compare)

  • Nov 22 15:28

    flash-gordon on release-3.6

    Fix mapping of PG cidr values t… Merge pull request #414 from ro… (compare)

Dawid Lenkiewicz
@dawidlenkiewicz
ok thanks :) makes sense
Peter Solnica
@solnic
@drqCode you need to specify which foreign_key should be used so has_many :tasks, foreign_key: :other_user_id
Constantin Căpățînă
@drqCode
@solnic yes, but I wanted to specify composite foreign key..
For example, has_many tasks, foreign_key: [:user_id, :other_user_id]
Nikita Shilnikov
@flash-gordon
rom-sql supports composite FKs but rom itself doesn't support multi-key composition, one can create a fake key by, I dunno, concatenation of keys in SQL but this is a really nasty workaround
FWIW composite PKs and FKs especially is PITA
mostly because of poor support in DB tooling around
David Dawson
@DangerDawson
@flash-gordon I also have had issues with using composite primary/foreign keys for join tables and then referencing them with associations whilst using Hanami, would the advice be not to use composite primary keys if you plan on using the built in associations?
Nikita Shilnikov
@flash-gordon
well yes, that is the general advice on the subject. You can create a unique index so that you won't lose the guaranties you had with composite keys but indexes are not free, take space and slow down the insert. Usually, it's not a big deal but it always depends
from the rdbms perspective you should use its capabilities to the limit but the problem is the world doesn't end with rdbms. tl;dr I didn't find composite keys particularly useful even when I wrote a ton of pl/sql
David Dawson
@DangerDawson
I suppose it all depends on the database in question, as from what I can remember the innodb (MySQL) engine stores data locally to its primary keys, which gives you a nice performance boost if just using primary keys for lookups / joins
Nikita Shilnikov
@flash-gordon
good point, at the same time mysql has really poor support for composite pks itself. IIRC there's no way to fetch the PK value after insertion, it also was/is a complication for rom
rom's general pattern let's say
David Dawson
@DangerDawson
So the general advice would be to use composite primary / foreign keys if you are happy to fallback to writing raw SQL and you the extra performance is required, otherwise stick to using singular primary keys
Nikita Shilnikov
@flash-gordon
yes
Lairan
@alex-lairan
Dawid Lenkiewicz
@dawidlenkiewicz

Hey is it possible to have query like for example:

collection.where{(horsepower =~ 100..200) | (horsepower =~ 500..600)}

but doing it dynamically? When the horsepower number of ranges is not known ?

basically by having an array (of n elements) of ranges
Lairan
@alex-lairan
If so, how to connect ROM to a MongoDB database?
Vasily Kolesnikov
@v-kolesnikov
@alex-lairan It isn't dead, I use it in couple of projects in production.
Oskar Szrajer
@gotar
@dawidlenkiewicz
>> Range.new(*[100, 200])
=> 100..200
it's normal ruby code, nothing related to ROM
Lairan
@alex-lairan

@v-kolesnikov how do you setup ?

I have this error on rails c :
https://pastebin.com/CALmeDiP (too big for gitter)

tldr: uninitialized constant Int

Oskar Szrajer
@gotar
@dawidlenkiewicz splat operator | * - for arrays | ** - for hashes
Vasily Kolesnikov
@v-kolesnikov
Looks like incompatible version of dry-types. I recomend you to play with rom-mongo step by step starting from scratch (without Rails).
Oskar Szrajer
@gotar
and you can use just a construction like:
For ranges, Sequel uses a pair of inequality statements:

collection.where(horsepower: 1..5)
# SELECT * FROM ... WHERE ((horsepowert >= 1) AND (horsepower <= 5))
Vasily Kolesnikov
@v-kolesnikov
rails, active-support, bootsnap, rom3... It might be so hard...
Dawid Lenkiewicz
@dawidlenkiewicz
@gotar hmm yes but the problem I'm facing is more Sequel related I think. It works what you wrote but I'm thinking is there a good way of constructing that query when we don't know how many ranges there are (and we need to use OR between them)
Lairan
@alex-lairan
Yes I know :(
Lairan
@alex-lairan
An empty one :
Traceback (most recent call last):
    11: from main.rb:1:in `<main>'
    10: from main.rb:1:in `require'
     9: from /home/necros/.rvm/gems/ruby-2.6.0/gems/rom-3.3.3/lib/rom.rb:14:in `<top (required)>'
     8: from /home/necros/.rvm/gems/ruby-2.6.0/gems/rom-3.3.3/lib/rom.rb:14:in `require'
     7: from /home/necros/.rvm/gems/ruby-2.6.0/gems/rom-3.3.3/lib/rom/relation.rb:5:in `<top (required)>'
     6: from /home/necros/.rvm/gems/ruby-2.6.0/gems/rom-3.3.3/lib/rom/relation.rb:5:in `require'
     5: from /home/necros/.rvm/gems/ruby-2.6.0/gems/rom-3.3.3/lib/rom/relation/class_interface.rb:8:in `<top (required)>'
     4: from /home/necros/.rvm/gems/ruby-2.6.0/gems/rom-3.3.3/lib/rom/relation/class_interface.rb:8:in `require'
     3: from /home/necros/.rvm/gems/ruby-2.6.0/gems/rom-3.3.3/lib/rom/relation/curried.rb:7:in `<top (required)>'
     2: from /home/necros/.rvm/gems/ruby-2.6.0/gems/rom-3.3.3/lib/rom/relation/curried.rb:8:in `<module:ROM>'
     1: from /home/necros/.rvm/gems/ruby-2.6.0/gems/rom-3.3.3/lib/rom/relation/curried.rb:9:in `<class:Relation>'
/home/necros/.rvm/gems/ruby-2.6.0/gems/rom-3.3.3/lib/rom/relation/curried.rb:17:in `<class:Curried>': uninitialized constant #<Module:0x000055ba132ea0b8>::Int (NameError)
source 'https://rubygems.org'

gem 'rom'
gem 'rom-mongo'

gem 'pry'
require "rom"
require "rom-mongo"

rom = ROM.container(:mongo, 'mongodb://localhost:27017/plezi_development')
Peter Solnica
@solnic
mongo adapter is outdated and not ready for production, I wouldn't recommend using it w/o making it up-do-date with rom 4.x and improving its implementation
Lairan
@alex-lairan
I'm a beginner user of ROM, it's easy to update the gem ? Or should I use Mongoid ?
There is not a lot of files :)
Peter Solnica
@solnic
this adapter needs a big update, I don't think it's gonna be a simple task, not to discourage you though, just being honest
Lairan
@alex-lairan

Ok, thanks @solnic

I will give up for this one, but use Dry for everything else :D

Vasily Kolesnikov
@v-kolesnikov
@solnic I have tried to upgrade rom-mongo to rom 4.x but pr's have not been reviewed. Could try again if it's needed.
Peter Solnica
@solnic
@v-kolesnikov nobody from the core team uses mongo so it's hard to keep up with this :(
I'll be working on rom again soon, I'll try to look into mongo adapter and your PR
Oskar Szrajer
@gotar
@dawidlenkiewicz not pretty but should works where{ id.in([[100,200], [500,600]].map{|x| Range.new(*x)}.map(&:to_a).flatten ) }
but for sure there is any option to join with .or
just doesn't remember how
Ethan Turkeltaub
@ethnt
Hi all, I'm having some issues with self-referential relations
Ethan Turkeltaub
@ethnt
The issue I believe is with using a view, I get the error: NoMethodError: undefined methodpreload_assoc' for #<ROM::Relation::Curried:0x00007f85cd8136e8>`
Calling combine(:regions) on the relation produces that error, but only when view is set. I see someone had this issue in 2017 but I'm not sure if it was ever resolved. I'm on ROM 4.2.1
Peter Solnica
@solnic
@ethnt add override: true
has_many :regions, view: :children, override: true
Ethan Turkeltaub
@ethnt
@solnic D'oh, thanks :) I'm the person from Discourse with the JSON/dry-types serialization issue, I'll work on reproducing it outside of our app. Would that be an issue I report to dry-types?
Peter Solnica
@solnic
@ethnt pls report in rom repo, it's most likely an issue in rom