by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Yogesh Khater
@yogeshjain999
But you can use the representer class explicitly in your operation using step signature.
Akshay Birajdar
@the-spectator
Thank you Very Much! @yogeshjain999
aavorov89
@aavorov89
@yogeshjain999 thank you for your answer!
also, do you know, seems the signature "failure" is also removed, but the signature "fail" is available. Are they the same?
Yogesh Khater
@yogeshjain999
Yep, they are same. success => pass and failure => fail
John Krueger
@jtmkrueger

so I'm resurrecting an old trailblazer application, and finding a lot of code like this

<%= concept('notification/cell/notification_index', @notifications) %>

that's now broken after upgrading to the latest version of trailblazer. Is this an old pattern that's been deprecated? If so, is there a suggested way to refactor this kind of thing to be more inline with current practices?

lol, love how when I finally get to the point of asking for help, I try one more thing and it works. I think what finally fixed this is adding cells-rails to my gemfile.
simonovich
@simonovich
@yogeshjain999
You did not understand me. The code works for the old version trb (1.1.2). But the same code does not work for the new version (>2).
What needs to be changed?
require 'representable/json'

class ApplicationOperation < Trailblazer::Operation
  extend Representer::DSL
  include Representer::Rendering

  def process(*); end
end
simonovich
@simonovich

@yogeshjain999
You say:

The compact DSL signature was removed as a part of upgrade, but we're working on adding it back because of the demand!!
But you can use the representer class explicitly in your operation using step signature."

Could you explain how to rewrite this code using step signature?
What is step signature?

Yogesh Khater
@yogeshjain999

@simonovich I thought you're using 1.1.2 itself.
If you've seen this upgradation guide http://trailblazer.to/gems/trailblazer/upgrading-1-to-2.html, it covers all things you should consider for 2.0 upgrade (And for 2.1, it's WIP at https://2019.trailblazer.to/2.1/docs/trailblazer.html#trailblazer-2-1-migration).

You can simply add a step which calls your representer now.

John Krueger
@jtmkrueger

Can anyone point me to where something like

  def show
    present Competitor::Update
  end

might originate in a controller? I can't seem to find where these helpers come from, and since they point to operations I assume they're provided by Trailblazer

John Krueger
@jtmkrueger
I find references like this in here and assume that this is a trailblazer thing or maybe used to be
John Krueger
@jtmkrueger
At some point did this functionality get removed? Or did the helpers get put in a different gem that I need to include as a dependency?
searching through the logs here I find a smattering of references, but nothing seems to pop up within the last couple years
if this did go away, how would the community suggest refactoring it?
(sorry for all the questions lately, I'm new to trailblazer and breathing life into old neglected codebases is hard)
Yogesh Khater
@yogeshjain999
Hey @jtmkrueger, I'm not really sure how old is that code but what version you're using ?
You can read more about how things tie up with Rails on http://trailblazer.to/gems/trailblazer/2.0/rails.html
John Krueger
@jtmkrueger
@yogeshjain999 I found a clue. trailblazer/trailblazer-compat#6
Looks like I'll be reverting to 2.0.7 from 2.1
Christer Jansson
@kondensatorn

Being a huge fan of rspec, I attempted this:

➜ bundle add rspec-trailblazer
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.
Could not find gem 'rspec-trailblazer' in any of the gem sources listed in your
Gemfile.

Sadness. Any ideas?

Christer Jansson
@kondensatorn
Apparently rspec-trailblazer is not listed on rubygems.org, is this intentional?
Nick Sutterer
@apotonick

Hey everyone! We decided to move our support communication channel to zulip-chat. It is golden-middle between groups/mailing lists and chats like gitter/slack/irc. It helps to organize discussions in threads, plus it got a nice interface that helps you to find any old discussion on a particular subject.

So in the end it will save a lot of time for all of us, and help all people who are looking for answers for specific questions that were already answered.
Of course at the beginning you can be confused a little bit because of quite raw interface, but in our experience - after day or two using it you should be happy about that transition.
So there is a link: https://trailblazer.zulipchat.com/join/od4yhihn6tra3ix39u4gks72/ and stay tuned! Because during the next days we will have a few more announcements related to the new website, new core team members, and plans about the future of trailblazer!

The Dry.rb team inspired us for this move! <3
John Krueger
@jtmkrueger
is this chat going to stay available? the logs are useful for finding mentioned things
I'm not asking to continue using it, just that it doesn't get blown away so that I can grep the logs :D
Adam Piotrowski
@adamsarin1_gitlab
I don't see any point to turining it off.
We will just make sure to replace links to zulip, so new users will join zulip
Nick Sutterer
@apotonick
@jtmkrueger We will also keep hopping in here every now and then
John Krueger
@jtmkrueger
Great, thanks for leaving it alive. I'm still working back in 2.0 land with compat so I'll need all the help I can get
(also still learning trailblazer, so understanding design choices and finding how folks refactored things in the past is super helpful)
simonovich
@simonovich

For TRB 1.1.2

class PostsController < ApplicationController
  def create
    respond Posts::Create, location: nil
  end

In the new trb version, respond does not work...

Nick Sutterer
@apotonick
@simonovich Yeah, sorry, we changed the way APIs work in 2.x
Gökhan Arlı
@sylow
@apotonick "Whoops. The confirmation link has expired or been deactivated." when trying to join zulip.... any invitation link for us?
Nick Sutterer
@apotonick
@sylow Working on it
We might invest some time to make it an ever-lasting link :laughing:
simonovich
@simonovich
@apotonick , could you explain how does it work now?
Adam Piotrowski
@adamsarin1_gitlab
@simonovich how zulipchat work? Or API in 2.1 ?;]
@sylow link worked?
Also i changed settings and you should be able to join just through https://trailblazer.zulipchat.com/
Juan Trejo
@trejo08
Hey guys, anyone knows a way to integrate swagger and generate api docs from trailblazer specs ?
I know that swagger can generate docs using DrySchemas but I'm loooking for a good way an practices to write specs and using at the same time to generate swager docs
Vivek Kumar
@viveksingh295_twitter

After upgrading from trailblazer 2.1.0rc1 to 2.1.0

class User::ValidateUpdate < Trailblazer::Operation
  step Model(User, :find_by, :custom_user_id)
  fail StepMacro::HandleNotFound, fail_fast: true
end


HandleNotFound = ->((ctx), *, &block) do
  ctx[:status] = :not_found
  if ctx[:model].nil?
    error = "#{ctx['model.class']} with the specified #{ctx['model.find_by_key']} cannot be found."
    ctx[:errors] << { field: ctx['model.find_by_key'].to_s, errors: [error] }
    Trailblazer::Operation::Railway.fail!
  end
end

Having issue with following code. model.class and model.find_by_key are null. any workaround for this ?

Adam Piotrowski
@adamsarin1_gitlab
Hey @viveksingh295_twitter since we moved this chat to https://trailblazer.zulipchat.com/ which helps us to organize all threads, could you please sign up there and ask same questions therE?
Arthur Leonard Andersen
@leoc
Hey there. Whats the best way to pretty print trailblazer operations and result objects? :)
Adam Piotrowski
@adamsarin1_gitlab
@leoc sorry for not giving you straight answer here, but we moved all communication to https://trailblazer.zulipchat.com/ - so if you could ask same question there, i will ensure that you will get your answer :) Since zulip is better in storing/searching given content, that would be more usefull for people that have same question
Arthur Leonard Andersen
@leoc
thanks, will do <3
Adam Piotrowski
@adamsarin1_gitlab
Great, thanks!
Mauricio
@banduk

Guys, I'having a problem with trailblazer in a rails app (6.0.3 on ruby 2.7.1)

NoMethodError: undefined method `failure' for Notification::Operation::Create:Class
module Notification::Operation
  class Create < BaseOperation
    ...
    failure :log!
    ...

Anyone knows if trailblazer is ready for this version of ror?

Mauricio
@banduk
Thanks @viveksingh295_twitter !