flash-gordon on release-3.6
Fix typo in streaming docs for … (compare)
flash-gordon on release-3.3
Fix typo in streaming docs for … Merge pull request #415 from rm… (compare)
dependabot[bot] on bundler
dependabot[bot] on bundler
Bump rack from 2.2.3 to 2.2.6.2… (compare)
repobot-file-sync[bot] on main
Update .repobot.yml from rom-rb… (compare)
solnic on main
Update and rename .action_hero.… (compare)
flash-gordon on master
Upgrade ROM-yaml Merge pull request #17 from Int… (compare)
function(...)
was first mentioned the syntax had switched from select()
to select { }
. That's a good switch point, IMO: inside the block you can do something like select { array_agg(:foo).as(:foobar) }
, outside the block you're back in Kansas. Right now it's mixed: select {}
puts you directly into the DSL but still has programmatic APIs like function
, and there are other entry points into the same DSL other than select {}
so you have potential for "wait, where exactly is this defined?" cognitive discontinuity with select()
.
# Currently, one pure DSL path, two mixed paths, one pure API-style path:
# Get a ProjectionDSL, use type-first DSL magic
select { array::array_agg(offer_type).as(:offer_types) }
# Get a ProjectionDSL, use API-style factory
select { function(:array_agg, :offer_type).as(:offer_types) }
# Use API-style, get a ProjectionDSL
select(offers[:offer_type].func { array::array_agg(:offer_type).as(:offer_types))
# Use API-style, but manually construct `Function` API-style
select(Function.new(ROM::SQL::Types::Any).array_agg(:offer_type).as(:offer_types))
# Two separate paths:
# API-style, `function` is a convenience factory for a `Function`, minimally equiv. to the above example
select(function(:array_agg, :offer_type).as(:offer_types))
# DSL magic
select { array_agg(:offer_type).as(:offer_types) }
tasks
in order to combine based on composite key?class Users < ROM::Relation[:sql]
schema do
attribute :user_id, Types::Int
attribute :other_user_id, Types::Int
primary_key :user_id, :other_user_id
associations do
has_many :tasks
end
end
end
class Tasks < ROM::Relation[:sql]
schema do
attribute :user_id, Types::ForeignKey(:users)
attribute :other_user_id, Types::ForeignKey(:users)
end
end
users.combine(:tasks).to_a # this result in a '... INNER JOIN users ON users.user_id = tasks.user_id WHERE ...'
has_many tasks, foreign_key: [:user_id, :other_user_id]
@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
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')
.or