Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gem migration and docs incomplete #8

Open
nomasprime opened this issue Dec 19, 2017 · 12 comments
Open

Gem migration and docs incomplete #8

nomasprime opened this issue Dec 19, 2017 · 12 comments

Comments

@nomasprime
Copy link

The endpoint code has been moved from Trailblazer to here but it looks like process wasn't completed because the only way I can seem to use the gem is bundling directly from Github.

Docs also need updating.

@apotonick
Copy link
Member

Hi Rick, we're in the process of finalizing the API, and then you will get new docs!

@nomasprime
Copy link
Author

nomasprime commented Dec 19, 2017

Thanks @apotonick, very much appreciated and liking Trailblazer 👍

In the meantime I have this controller:

class ArticlesController < ApplicationController
  include Trailblazer::Endpoint::Controller

  def show
    endpoint Article::Operation::Show.(:id => params[:id]) do |m|
      m.success do |result|
        render :html => cell(
          Article::Cell::Show,
          result["model"],
          :layout => App::Cell::Layout
        )
      end
    end
  end
end

I'm getting uninitialized constant Trailblazer::Endpoint::Controller::Handlers.

Any ideas?

Not sure if I'm the bug so thought I'd mention here and raise separately if need be.

@apotonick
Copy link
Member

Uhm, it looks like you're using a very old version, I can give you a working version later tonight.

@nomasprime
Copy link
Author

@apotonick no probs. I'll pop it on Gitter in meantime, client's breathing down my neck 🙄

@apotonick
Copy link
Member

Not sure this will help, since that gem hasn't been released, yet, and underwent many changes and redesigns.

@nomasprime
Copy link
Author

@apotonick cool, I'll put in a workaround for now until you get a chance.

@apotonick
Copy link
Member

Yeah, just run the op manually in the controller and add some ifs, I can later help you migrate it to the stable API.

@nomasprime
Copy link
Author

nomasprime commented Dec 19, 2017

class ArticlesController < ApplicationController
  def show
    result = Article::Operation::Show.(:id => params[:id])

    if result.success?
      render :html => cell(
        Article::Cell::Show,
        result["model"],
        :layout => App::Cell::Layout
      )
    elsif result["model"].nil?
      render(
        :html => cell(
          App::Cell::Error,
          nil,
          :layout => App::Cell::Layout
        ),
        :status => 404
      )
    end
  end
end

I'm a TB noob, can you tell 😄

@apotonick
Copy link
Member

So there's one thing you could take advantage of already, that's render from trailblazer-rails: http://trailblazer.to/gems/trailblazer/2.0/rails.html#render

Other than that, what you do here is basically what your endpoint will abstract in a few hrs. 😜

@agis-theodoropoulos
Copy link

Hello!

Is there an ETA for the gem's release?

@apotonick
Copy link
Member

Good timing, there's an endpoint team meeting scheduled for next week, we will then publish a roadmap. I'd say somewhere in March?

@agis-theodoropoulos
Copy link

Excellent! I'm looking forward to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants