Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 13 15:58
    rokhimin starred dry-rb/dry-matcher
  • Dec 13 08:53
    flash-gordon labeled #376
  • Dec 13 08:44
    solnic commented #376
  • Dec 12 21:34
    flash-gordon commented #376
  • Dec 12 21:34
    flash-gordon labeled #376
  • Dec 12 21:34
    flash-gordon opened #376
  • Dec 12 19:32
    RyanLafferty starred dry-rb/dry-types
  • Dec 12 05:53
    technofreak starred dry-rb/dry-monads
  • Dec 12 00:14
    thekuwayama starred dry-rb/dry-monads
  • Dec 11 09:29
    blasterun starred dry-rb/dry-monads
  • Dec 11 08:34
    flash-gordon closed #115
  • Dec 11 08:34
    flash-gordon commented #115
  • Dec 11 08:31

    flash-gordon on v1.3.3

    (compare)

  • Dec 11 08:30

    flash-gordon on master

    Bump version to 1.3.3 (compare)

  • Dec 11 08:30

    flash-gordon on master

    Update CHANGELOG (compare)

  • Dec 10 23:46
    johnmaxwell commented #116
  • Dec 10 21:54

    flash-gordon on master

    Halt with mutable backtrace Ex… Merge pull request #116 from jo… (compare)

  • Dec 10 21:54
    flash-gordon closed #116
  • Dec 10 21:54
    flash-gordon commented #116
  • Dec 10 21:49
    johnmaxwell commented #116
Oskar Szrajer
@gotar
those 14 line is: notifications.instrument(:sql, name: name.relation, query: dataset.sql)
and notifications are just nil
Piotr Rybarczyk
@Argonus
Hi, i am using dry-validation and dry-struc gems in project. But i see a problem with boolean values in params, i am receiving it as 'true' or 'false', and bool? validation fails. I need to map them or i just cant find some info in documentation
Nikita Shilnikov
@flash-gordon
@Argonus you need to use Dry::Validation.Form for such coercions
Piotr Rybarczyk
@Argonus
@flash-gordon Thanks, i had to be blind...
Gustavo Caso
@GustavoCaso
Hello everyone
Excited to be here and been able to try the dry-rb gems
Hope to contribute to all this new libraries
Tim Riley
@timriley
Welcome, @GustavoCaso! Looking forward to hearing how they go for you.
@gotar Ah! Now I’m back on a computer, I have a feeling your problem might be that you have a Athit::Container["notifications”], but not a Main::Container[“notifications”].
is your rom bootable dep inside the Athit or Main system?
Oskar Szrajer
@gotar
inside Athit
gotar ~/Programowanie/Athit (master) ~ $ tree system/
system/
├── athit
│   ├── application.rb
│   ├── assets.rb
│   ├── container.rb
│   ├── import.rb
│   └── settings.rb
├── boot
│   ├── bugsnag.rb
│   ├── i18n.rb
│   ├── monitor.rb
│   └── rom.rb
└── boot.rb

2 directories, 10 files
@timriley probably you guys will update berg in the (i hope near) feature. So I will check there and compare where I might have a problem
Alejandro E. Babio
@alejandrobabio

Hi, I'm thinking on move business logic to a dry-transaction in a Rails app. As first try I built a class for create a Post:

class Post
  class Container
    extend Dry::Container::Mixin

    register :build_params, -> (params) {
      Dry::Monads.Right(params[:post])
    }

    register :validate, -> (input) {
      if input[:body].nil? || input[:title].nil?
        Dry::Monads.Left(:not_valid)
      else
        Dry::Monads.Right(input)
      end
    }

    register :persist, -> (input) {
      Post.create Dry::Monads.Right(input)
    }
  end

  class CreatePost
    def initialize(params)
      save_user = Dry.Transaction(container: Container) do
        step :build_params
        step :validate
        step :persist
      end
      save_user.call(params)
    end
  end
end

It should create a new Post when it's called with:

Post::CreatePost.new(post: {body: 'ab', title: 'AB'})

But I'm getting the error:

NoMethodError: undefined method `Right' for Dry::Monads:Module
from /home/alejandro/.rvm/gems/ruby-2.3.3@rails501/gems/dry-transaction-0.9.0/lib/dry/transaction/api.rb:40:in `call'

Have you some idea of what I'm doing wrong? I tried to build something pretty similar to the basic example of dry-transaction.

Nikita Shilnikov
@flash-gordon
@alejandrobabio can be easily fixed with require 'dry/monads' :)
Alejandro E. Babio
@alejandrobabio
Good! Thank you!
Nikita Shilnikov
@flash-gordon
not all the monads are required for dry-transaction hence those methods are not required by default
Alejandro E. Babio
@alejandrobabio
Thanks for say that. Now it's working.
Piotr Solnica
@solnic
@gotar I think I know why you had issues with instrumentation patch in rom, you basically can’t boot!(:rom) too early, otherwise patch won’t be applied before your relations are built
Oskar Szrajer
@gotar
yeah i assume it's condition problem, is there a way to force order, like in rom force loading monit first? maybe in init?
@solnic
for now i just add:
        notifications ||= Athit::Container[:notifications]
        notifications.instrument(:sql, name: name.relation, query: dataset.sql) do
          super
        end
works, but it's ugly hack
Oskar Szrajer
@gotar
:facepalm: ok fixed ;]
there is just use :monitor missing in rom boot file (init section)
@timriley @solnic
so probably should be added to dry-web-roda geenrator too
thx guys for help
Oskar Szrajer
@gotar
@timriley I already add those missing line to dry-web-roda skeleton apps
Tim Riley
@timriley
@gotar oh! Would you mind PR-ing this? I'll add you as a contributor if you're not already, too.
Oskar Szrajer
@gotar
I put this automaticaly on master branch (for mistake ;P) hope you don't mind
specs do not catch this problem with monitor because non of them use db
Piotr Solnica
@solnic
@gotar well first of all I need to add notifications support to rom, so that we don’t have a monkey patch :)
I’ve got it in a local branch, I’ll push this tomorrow
Tim Riley
@timriley
@gotar oh no worries, master is good. I actually want to add some specs that generate an app and add enough files to set up a persistence layer, just to test that all works properly
Oskar Szrajer
@gotar
now should all works
probably there is not to much users of those skeletons but I use them for every app ;]
Tim Riley
@timriley
😎
Piotr Solnica
@solnic
@flash-gordon so I started working on ASTs for dry-types here dry-rb/dry-types#178
Nikita Shilnikov
@flash-gordon
@solnic yeah, I see what you're doing there 😀
Piotr Solnica
@solnic
@flash-gordon this was my intention from the beginning, I’m pretty sure reducing types into simpler forms will be a great feature useful in many places
the only thing that worries me a little is that constructors can’t be represented with pure data :(
as in, if you use an anonymous proc instead of a method-based proc, you can’t represent it as data
in case of class methods it’d be possible, ie [:constructor, [User, :new]]
which can be easily compiled as klass, meth = node + klass.method(meth) :)
Nikita Shilnikov
@flash-gordon
@solnic well, you can register procs as methods with generated names
Piotr Solnica
@solnic
hmmm you mean capture them in #constructor and register somewhere?
Nikita Shilnikov
@flash-gordon
yep