Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • May 23 23:46

    dependabot[bot] on bundler

    (compare)

  • May 23 23:46
    dependabot[bot] closed #342
  • May 23 23:46
    dependabot[bot] commented #342
  • May 23 23:46
    dependabot[bot] labeled #343
  • May 23 23:46
    dependabot[bot] labeled #343
  • May 23 23:46
    dependabot[bot] opened #343
  • May 23 23:46

    dependabot[bot] on bundler

    Bump nokogiri from 1.11.4 to 1.… (compare)

  • May 23 08:32
    solnic milestoned #411
  • May 23 08:32
    solnic opened #411
  • May 23 08:32
    solnic labeled #411
  • May 23 08:32
    solnic labeled #411
  • May 20 15:51
  • May 20 09:09
    solnic commented #410
  • May 19 18:49
    paddor commented #410
  • May 19 15:20
    flash-gordon commented #410
  • May 19 15:18
    flash-gordon commented #410
  • May 19 12:44
    paddor labeled #410
  • May 19 12:44
    paddor labeled #410
  • May 19 12:44
    paddor opened #410
  • May 18 20:39

    dependabot[bot] on bundler

    (compare)

Ethan Turkeltaub
@ethnt
Hi guys, another question. I have a recursive relation: a country has many regions, which has many regions. is there a way to recursively get all of the regions of a country?
countries_repositories.aggregate(region: :region) gets the first two layers but not below that
Piotr Solnica
@solnic
@ethnt there's no special feature to cover this. You could write some smart query yourself to get it effectively.
Ethan Turkeltaub
@ethnt
@solnic Good to know, thanks :+1:
Ethan Turkeltaub
@ethnt
@solnic I guess in a similar vein, is there a recommendation for trees in ROM or just use self-referential associations?
Piotr Solnica
@solnic
I used tree extension in PG for that
Ethan Turkeltaub
@ethnt
If only I could use PG 🙃stuck on MySQL
Piotr Solnica
@solnic
@ethnt that's unfortunate, because the implementation in PG was like few lines of code, I really liked it
we even have a special type for ltree: https://github.com/rom-rb/rom-sql/blob/master/lib/rom/sql/extensions/postgres/types/ltree.rb it gives you custom API for queries like people.select(:name).where { ltree_tags.match_any(['Bottom', 'Bottom.Cities.*']) } :)
Mihai Radulescu
@mihairadulescu
hey guys did anyone experienced lately MySql connection has Gone away when using rom.rb in Aurora Db Mysql ?
Nikita Shilnikov
@flash-gordon
I don't think this kind of issues could be directly related to rom, although it's possible databases close connections after a certain timeout. I know that Sequel has a workaround for that and I'm pretty it sure you can use it with rom
assuming my guess is right ofc
Mihai Radulescu
@mihairadulescu
already have that connection validator in place.
Nikita Shilnikov
@flash-gordon
huh
so in any case I would look deeper, maybe search through sequel's issues for advice
or ask Jeremy on the google groups
Mihai Radulescu
@mihairadulescu
yeah will check into sequel groups
Dawid Lenkiewicz
@dawidlenkiewicz
Hey is it possible to write this query without directly calling Sequel?
collection = collection.where { Sequel.|(*search_params.horsepower_ranges_map) }
this search_params.horsepower_ranges_map returns array of hashes like: [ { horsepower: 100..200 }, { horsepower: 500..600} ]
Viet (Drake) Tran
@tiev
@solnic Does rom-roda work with Rom v4?
Viet (Drake) Tran
@tiev
I've tried rom-roda with rom v4 and failed. Do you think the interface of rom-roda should change? Can I contribute to make it work with rom v4?
Vasily Kolesnikov
@v-kolesnikov
@tiev rom-roda looks outdated. But there isn't much sense to use this plugin. You can use rom and roda together without any additional libraries. For example: https://github.com/v-kolesnikov/elias/tree/feature/api_v1
Viet (Drake) Tran
@tiev
ah, it's dry-web-roda
it is promising
Tim Riley
@timriley
dry-web-roda has been retired, @tiev, so we won’t be updating it.
You’ll probably just want to update your app’s rom integration yourself, making whatever changes are required
Oskar Szrajer
@gotar
@tiev I'm using dry-web-roda, and it's working with ROM 4
I just made few changes to make it works
Piotr Solnica
@solnic
@tiev there's no need for rom-roda, I need to delete this repo. if you want to use rom + roda it's better to either set it up yourself or use dry-web-roda
Viet (Drake) Tran
@tiev
Thanks all.
Viet (Drake) Tran
@tiev
Hi Tim. I like functional oop architecture. Any specific problems that dry-web-roda gets retired?
Piotr Solnica
@solnic
@tiev we've started helping with Hanami and this is where our focus will be, not dry-web-roda. The plan is to make Hanami 2.0 work nicely with dry-rb, its alpha version already supports dry-system. We'll improve other integrations, like dry-validation, dry-view etc. too.
Dawid Lenkiewicz
@dawidlenkiewicz
Hey I've got a query that uses distinct on + order notation. It works well, but in the end I want to order results by some attribute and it looks like initial ordering is overwritten
Dawid Lenkiewicz
@dawidlenkiewicz

end of initial query:

ORDER BY \"car_model_id\", \"finance_rate_cents\"">>

after applying ordering like order { Sequel[column_name].send(order_direction, nulls: :last) }

the end of query changes to order specified above

can I somehow wrap it to force subquery ?
Dawid Lenkiewicz
@dawidlenkiewicz
something like this works:
relations[:offers].new(relations[:offers].dataset.select_all.from(collection.dataset)).order_by(
but doesn't look nice :) Maybe there is a better way?
Piotr Solnica
@solnic
@dawidlenkiewicz can you provide a script that shows this?
Dawid Lenkiewicz
@dawidlenkiewicz
yes, sorry it may not be easy to understand the way I wrote this

I guess the simple example is:

relation:

  def test
    select { %i(car_model_id score horsepower) }.distinct(:car_model_id).order(:car_model_id, :score)
  end
[1] pry(#<OffersRepository>)> relations[:offers].test
=> #<OffersRelation name=ROM::Relation::Name(offers) dataset=#<Sequel::Postgres::Dataset: "SELECT DISTINCT ON (\"car_model_id\") \"offers\".\"car_model_id\", \"offers\".\"score\", \"offers\".\"horsepower\" FROM \"offers\" ORDER BY \"car_model_id\", \"score\"">>

[2] pry(#<OffersRepository>)> relations[:offers].test.order(:horsepower)
=> #<OffersRelation name=ROM::Relation::Name(offers) dataset=#<Sequel::Postgres::Dataset: "SELECT DISTINCT ON (\"car_model_id\") \"offers\".\"car_model_id\", \"offers\".\"score\", \"offers\".\"horsepower\" FROM \"offers\" ORDER BY \"horsepower\"">>
I'm wondering what is the "proper" way to wrap the query
Piotr Solnica
@solnic
@dawidlenkiewicz so you want to append more columns for ordering?
Dawid Lenkiewicz
@dawidlenkiewicz
the end goal is SELECT * FROM ( SELECT DISTINCT ON ..... ORDER BY car_model_id, score) ORDER BY horsepower
so using a subquery
Piotr Solnica
@solnic
@flash-gordon ^^ subqueries are not yet supported OOTB, right?
Nikita Shilnikov
@flash-gordon
nah, not supported, mostly because it’s rarely needed