Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Oskar Szrajer
@gotar
module Berg
  class Repository < ROM::Repository::Root
    # This .new shouldn't be needed, since repos should work with dry-
    # auto_inject. This is not working yet, so this remains as a workaround.
    def self.new(rom = nil)
      super(rom || Berg::Container["persistence.rom"])
    end
  end
end
Piotr Solnica
@solnic
uhm I thought we made that work
Andy Holland
@AMHOL
@gotar @solnic yeah, pretty sure @timriley fixed that, probably just that the skeleton hasn't been updated
Oskar Szrajer
@gotar

my Gemfile:

source "https://rubygems.org"

ruby "2.3.0"

# Web framework
gem "dry-web", github: "dry-rb/dry-web"

# Database persistence
gem "sqlite3"
gem "rom",            github: "rom-rb/rom"
gem "rom-mapper",     github: "rom-rb/rom-mapper"
gem "rom-repository", github: "rom-rb/rom-repository"
gem "rom-sql",        github: "rom-rb/rom-sql"
gem "rom-support",    github: "rom-rb/rom-support"

# Application dependencies
gem 'rake'
gem "dry-validation", github: "dryrb/dry-validation"

group :test do
  gem "rspec"
  gem "rack-test"
end

and it's not working still

but maybe i'm doing sth in a wrong way
Piotr Solnica
@solnic
yeah you defo need auto-inject and auto-component from master too
better wait for Tim
Oskar Szrajer
@gotar
uuh ok
my mistake I miss those two
Oskar Szrajer
@gotar
hmm even on master sth not works. will w8 for @timriley maybe he have some working example
Nikita Shilnikov
@flash-gordon
oh, auto-expand again
@gotar I use auto_inject from master, < ROM::Repository[:posts] instead of < ROM::Repository, and ArgsImport because kwargs is the default strategy atm but rom-repo requires sequential arguments
Oskar Szrajer
@gotar
ok then maybe it's the problem with those kwargs, will try ArgsImport, thx
Oskar Szrajer
@gotar
@flash-gordon can you put somewhere whole exmapled code, still not sure how to define it
Nikita Shilnikov
@flash-gordon
@gotar wdym? The link I posted is the whole example :)
Piotr Solnica
@solnic
uhm, we should change it to accept kwargs
Nikita Shilnikov
@flash-gordon
I mean gist, not this cropped preview
Piotr Solnica
@solnic
I’m pretty sure it’s gonna need more options soon :D
Nikita Shilnikov
@flash-gordon
:laughing:
Oskar Szrajer
@gotar
ah sorry, It's to late for me :p
I try to prepare workshops based on rom, roda, and whole Dry stack but already see it will be too hard to accept by anyone
need to think how to go through it
Fran Worley
@fran-worley
@solnic is there a way of distinguishing between a :key? rule being created via required/optional vs the value block?
Piotr Solnica
@solnic
@gotar rom-rb or roda alone would be a lot for a single workshop :)
@fran-worley not really. why?
Fran Worley
@fran-worley
Trying to raise an error when you do: required(:foo) { key? } I can catch it easily with the macros but not with the blocks...
Piotr Solnica
@solnic
it’d be better to do that thing we talked about last month with predicates being available already when DSL is initialized
then we can explicitly define which predicates are available where
and improve UX in general
Fran Worley
@fran-worley
that's true. I'll take out the changes I made in #177 and then it can merge as its just spec updates?
Piotr Solnica
@solnic
actually that part can stay
just merge it in :)
Fran Worley
@fran-worley
Ok cool, does the error name make sense? InvalidSchemaError ?
Piotr Solnica
@solnic
yep
Fran Worley
@fran-worley
cool
Piotr Solnica
@solnic
seems like the fixes in dry-types made tons of specs pass :)
Fran Worley
@fran-worley
I got the whole lot to pass, then skipped another load which were fudged
Ralf Schmitz Bongiolo
@mrbongiolo
@solnic dry-rb/dry-validation#172 should be passing now too, I updated my app code and the array? rule seems to be working correctly
Piotr Solnica
@solnic
@mrbongiolo pls merge these specs in if they are passing now
Ralf Schmitz Bongiolo
@mrbongiolo
let me check it
Ralf Schmitz Bongiolo
@mrbongiolo
@solnic that's weird, in my app it's working, but the specs are still failing...
Piotr Solnica
@solnic
@mrbongiolo it needs dry-types from master
Ralf Schmitz Bongiolo
@mrbongiolo
@solnic shouldn't a bundle update get it from master already?
Piotr Solnica
@solnic
yeah but travis is weird with caching so…maybe remove cache and restart
Ralf Schmitz Bongiolo
@mrbongiolo
@solnic the build passed on Travis, for some reason my local build doesn't want to update dry-types or is just not using the version from master, gonna check out later what's going on
Oskar Szrajer
@gotar

Another probably stupid question ;]

require "dry-validation"

module Validations
  PostValidator = Dry::Validation.Form do
    required(:title) { filled? & str? }
    required(:body){ filled? & str? }
  end
end

if I have Validator like this how I can use it with AutoInject? There is no method new to call by it, t's just a function. I need to mark it somehow or do sth else?

Blog::Container["validations.post_validator"]
NoMethodError: undefined method `new' for #<#<Class:0x007fdbb0c8b1b0>:0x007fdbb0bf2898>
    from /Users/gotar/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/dry-component-0bebc656b625/lib/dry/component/loader.rb:42:in `instance'
Nikita Shilnikov
@flash-gordon
@gotar I know @timriley had a similar issue. I don't use dry-component atm so I don't know how to handle it properly, too high level for me :)
Oskar Szrajer
@gotar
ok I have solution