Questions tagged [trailblazer]

Trailblazer is a thin layer on top of Rails. It gently enforces encapsulation, an intuitive code structure and gives you an object-oriented architecture.

Trailblazer gives you a high-level architecture for web applications. It extends the basic MVC pattern with new abstractions. Rock-solid conventions that go far beyond database table naming or route paths let you focus on your application code, minimize bugs and improve the maintainability.

https://github.com/trailblazer/trailblazer

61 questions
4
votes
1 answer

Trailblazor operation -> collection :attribute(has_many through association) with populator -> How to populate the Reform::Form form array of slugs?

I'm using gem trailblazer. I have following structure. Following two models class Company has_many :acquirable_source_companies, class_name: 'AcquirableSourceCompany', foreign_key: 'acquirer_company_id', …
Hiren Bhalani
  • 848
  • 9
  • 17
4
votes
1 answer

Trailblazer: Which step caused my operation to fail?

Given an operation like class MyOperation < Trailblazer::Operation step :do_a! step :do_b! def do_a(options, **) false end def do_b(options, **) true end end and the result of run(MyOperation), how can I tell which step of the…
Simon Jakobi
  • 117
  • 6
4
votes
1 answer

Trailblazer Cells and Devise current_user in RSpec

Trailblazer recommends injecting current_user into the cell, like this <%= concept(Appointment::Cell::UserStatus,user,current_user: current_user) %> One could then make it accessible within the cell using a method def current_user …
port5432
  • 5,889
  • 10
  • 60
  • 97
4
votes
3 answers

Kaminari::Cells paginate method not rendering anything

I'm using the Kaminari::Cells gem, and when I use the paginate method in a cell view, nothing shows up. I checked, and the paginate method is just returning "\n".
neurodynamic
  • 4,294
  • 3
  • 28
  • 39
4
votes
1 answer

Testing Cells in isolation with Rspec - any recommandation?

I'm giving a try to Apotonick's Trailblazer gem, which brings more structure on top of Rails, and I really like what I tried so far, while not having embraced all of it yet. And this is one strength of Trailblazer, you can dive into it…
demental
  • 1,444
  • 13
  • 25
3
votes
1 answer

What does double splat (**) argument mean in this code example and why use it?

So I've been over Traiblazer and Reform documentation and I often see this kind of code class AlbumForm < Reform::Form collection :songs, populate_if_empty: :populate_songs! do property :name end def populate_songs!(fragment:, **) …
Dorian
  • 2,571
  • 23
  • 33
3
votes
1 answer

Reform: Dry-Validation Matchers

I'm looking for a convenient way to test validations of a Reform-based form object. Are there any matchers (like shoulda matchers for testing ActiveModel::Validations) to test dry-validations? Is this even the way to go?
Arvinje
  • 328
  • 2
  • 16
3
votes
2 answers

superclass mismatch error from class in Trailblazer operation when making changes to Rails code while server is running

I'm using the Trailblazer gem with Rails, and there's a Cell class inside one of my Trailblazer operations that starts throwing a superclass mismatch error whenever I change the code with the server running. If I start the server and immediately…
neurodynamic
  • 4,294
  • 3
  • 28
  • 39
3
votes
1 answer

In Rails4, using Trailblazer, how do I access the current_user

We are building a Rails4 app using Trailblazer. I have never worked with Trailblazer before and I am confused about how to do things. We are building an auction site. I was previously using a traditional controller, and this route endpoint was…
JeffGallant
  • 409
  • 2
  • 6
  • 17
2
votes
1 answer

dry-validation: dynamically change locale?

I am using Trailblazer 2.1 (and dry-validation (0.11.1) consequently) in a Rails 5 project. I have 2 different language locales bound to the user profile. When I dynamically change the user's locale - dry-validation does not notice it - and keeps…
prograils
  • 2,248
  • 1
  • 28
  • 45
2
votes
1 answer

Rendering partial forms in Trailblazer Cells

In my Trailblazer cell I am rendering a fairly dynamic form. I'd like to do something like this: concepts/card_form/views/_deck_form.erb* <%= simple_form_for [parent,card] do |f| %>
<%= render…
port5432
  • 5,889
  • 10
  • 60
  • 97
2
votes
1 answer

undefined method `persisted?' with Reform and Virtus model

I'm currently developing an Rails app (rails v5.1.1 and ruby v2.3.4) and I'm getting an error when trying to use a reform form object at one of my routes (/bookings/new): undefined method `persisted?' for # I'm using a…
Igor_Marques
  • 1,742
  • 2
  • 16
  • 24
2
votes
0 answers

Trailblazer generating a loading error only when a "step Macro" is used

I'm running into a loading issue with my Trailblazer-Rails app. I can solve the loading issue using require, but, based on trailblazer-loader's readme, it doesn't seem like I should need to use `require. My app has a file structure like…
John
  • 9,249
  • 5
  • 44
  • 76
2
votes
1 answer

Undefined method `model_name` for reform object

I keep on getting: Undefined method `model_name` for # I'm pretty sure I'm missing something. I've followed the installation instruction and everything. What could be the reason? Model: class Donation <…
RubyCat
  • 155
  • 11
2
votes
0 answers

Trailblazer Rails form error "unknown keywords: doc, options, represented, decorator, binding, as, index, model, collection"

I'm using the trailblazer gem with Rails, and trying to get it to work with a form with nested models. So far, I'm only trying to adapt the create and update actions to use Operations. Updating pre-existing nested models works fine. Creating new…
neurodynamic
  • 4,294
  • 3
  • 28
  • 39
1
2 3 4 5