Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 05 09:29

    solnic on master

    Clear exception message when an… Add gem names to plugins Merge pull request #128 from sk… (compare)

  • Dec 05 09:29
    solnic closed #128
  • Dec 05 09:29
    solnic closed #127
  • Dec 04 18:49
    micahphone starred dry-rb/dry-monads
  • Dec 04 17:43
    icy-arctic-fox starred dry-rb/dry-types
  • Dec 02 12:37
    pedrofurtado starred dry-rb/dry-view
  • Dec 02 11:59
    lenon starred dry-rb/dry-monads
  • Dec 01 11:06

    flash-gordon on declare-finalized

    (compare)

  • Dec 01 11:06

    flash-gordon on master

    Set initial value for ivar Merge pull request #131 from dr… (compare)

  • Dec 01 11:06
    flash-gordon closed #131
  • Dec 01 11:05
    flash-gordon opened #131
  • Dec 01 11:03

    flash-gordon on declare-finalized

    Set initial value for ivar (compare)

  • Nov 30 16:50
    paul commented #32
  • Nov 30 16:50
    paul synchronize #32
  • Nov 30 16:44
    paul synchronize #32
  • Nov 30 16:02
    paul synchronize #32
  • Nov 30 16:01
    paul commented #32
  • Nov 30 12:12

    flash-gordon on master

    Use GH badge for CI status (compare)

  • Nov 30 12:08

    dry-bot on master

    [devtools] config sync (compare)

Tim Riley
@timriley
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
Piotr Solnica
@solnic
Worth exploring this idea
Maciej Mensfeld
@mensfeld
guys where's configurable 0.6.0?
I can't bundle it :/
Maciej Mensfeld
@mensfeld
ok nvmd - something with bundler cahce
Nikita Shilnikov
@flash-gordon
@mensfeld it seems @AMHOL has bumped version number only a few minutes ago
Maciej Mensfeld
@mensfeld
@flash-gordon yeah ;) I was just 2 fast and hit a rubygems server that was out of sync
Pablo Herrero
@pabloh
why does Dry::Validation::Result is not a monad as well?
Nikita Shilnikov
@flash-gordon
@pabloh because dry-monads is not a required dependecy of dry-validation
Pablo Herrero
@pabloh
@flash-gordon, I think it would we useful to have it that way