Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Nov 21 13:50
  • Nov 20 19:40
    lancecarlson starred dry-rb/dry-monads
  • Nov 20 15:22
    scaint starred dry-rb/dry-monads
  • Nov 20 11:05
    FunkyloverOne starred dry-rb/dry-monads
  • Nov 20 06:22
    zlei1 starred dry-rb/dry-web
  • Nov 18 00:58
    dteoh starred dry-rb/dry-types
  • Nov 17 21:02
    flash-gordon commented #374
  • Nov 17 21:01

    flash-gordon on master

    Update custom_ci.yml Merge pull request #374 from sk… (compare)

  • Nov 17 21:01
    flash-gordon closed #374
  • Nov 17 20:59
    skryukov opened #374
  • Nov 17 16:42

    flash-gordon on use-immutable-equalizer

    (compare)

  • Nov 17 16:42

    flash-gordon on master

    Use immutable equalizer for all… Merge pull request #373 from dr… (compare)

  • Nov 17 16:42
    flash-gordon closed #373
  • Nov 17 16:38
    flash-gordon opened #373
  • Nov 17 16:38

    flash-gordon on use-immutable-equalizer

    Use immutable equalizer for all… (compare)

  • Nov 17 16:34

    flash-gordon on no-rewrap-for-structs

    (compare)

  • Nov 17 16:34

    flash-gordon on master

    Don't build constructors when c… Merge pull request #371 from dr… (compare)

  • Nov 17 16:34
    flash-gordon closed #371
  • Nov 16 11:28
    marekciupak starred dry-rb/dry-monads
  • Nov 16 07:48
    luizfonseca starred dry-rb/dry-view
Piotr Solnica
@solnic
sweeet
Fran Worley
@fran-worley
Are you happy for me to close the issues now fixed?
dry-validation issues: #125
Piotr Solnica
@solnic
@fran-worley yes please!
Fran Worley
@fran-worley
@solnic with regards to #134, would you raise the error when compiling the schema or when trying to validate ?
Piotr Solnica
@solnic
@fran-worley the dsl should yell when somebody tries to do that
Fran Worley
@fran-worley
so basically:
it "should raise error" do
  expect { Dry::Validation.Form do
      required(:foo).maybe(:none?)
    end }.to raise_error SomeError
end
Oskar Szrajer
@gotar

If I have container like:

require 'dry/web/container'

module Blog
  class Container < Dry::Web::Container
    setting :auto_register, 'lib'

    configure do
      load_paths!('lib')
    end
  end
end

and in lib directory I have for example repository, that require single arg when initialize, how I can do that? Container above register it automatically without any args,

module Persistence
  module Repo
    class Posts < ROM::Repository
      relations :posts

      def index
        posts.to_a
      end
    end
  end
end
>> Blog::Container['persistence.repo.posts']
ArgumentError: wrong number of arguments (given 0, expected 1)
    from /Users/gotar/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/rom-repository-37ec20210a66/lib/rom/repository.rb:33:in `initialize'
Piotr Solnica
@solnic
@gotar you can use it with auto-inject thingie
include YourInjectModule[“your.rom.container”]
Oskar Szrajer
@gotar

hmm ok then I define sth like:

require_relative 'container'

module Blog
  Import = Container.import_module

  def self.Import(*args)
    Import[*args]
  end
end

and then

require "blog/import"

module Persistence
  module Repo
    class Posts < ROM::Repository
      include Blog::Import("persistence.rom")

      relations :posts

      def index
        posts.to_a
      end
    end
  end
end
??
those above do not works for me
but I think i'm close
Fran Worley
@fran-worley
@solnic I assume that it also should raise an error if you try to do: required(:foo).filled(:filled?)
Oskar Szrajer
@gotar
I was trying to find in any article or repo but have no luck
Piotr Solnica
@solnic
@fran-worley yep
@gotar it’s a recent improvement
@gotar icelab’s skeletons might have it
see Berg app
Oskar Szrajer
@gotar
I read whole code of berg and skeleton, but didn't found it. He do not use Repository
and define all relation and commands containers manually
but if it's AutoInject then I will find a way
Piotr Solnica
@solnic
@gotar make sure you’re using latest-latest-latest stuff
although auto-inject was recently released
so maybe it’s ok to use released ver, I’m not really up-to-date with the recent stuff, better ask @timriley
Oskar Szrajer
@gotar
i always use master master
in all my projects ;] even produciton
I will try to skip Import and use AutoInject manually
Oskar Szrajer
@gotar
ok found it, eh
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: