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
0
votes
1 answer

How to mock dry-rb (used inf Reform contract) validation configure method

My problem is that I want to mock my custom validation method that returns some data from DB ( list of ids - to check if given id is in my DB ). So less talk, more code: in my Newsletter::Contract::Create class I have validation do configure do …
Adam Piotrowski
  • 674
  • 1
  • 7
  • 15
0
votes
2 answers

Why does the “no implicit conversion of Symbol into Hash” error occur in Trailblazer?

I ran into one problem that I cannot solve on my own for a week - I am desperate. I got a Rails 5.2 project that has a Trailblazer on board. In one place of the application, I catch this error: TypeError - no implicit conversion of Symbol into…
Colibri
  • 993
  • 11
  • 29
0
votes
1 answer

Trailblazer Contracts overrides params

I have this operation: require 'bcrypt' class User::Create < Trailblazer::Operation extend Contract::DSL contract 'params', (Dry::Validation.Schema do required(:email).filled required(:password).filled end) step …
Jeremie Ges
  • 2,747
  • 3
  • 22
  • 37
0
votes
2 answers

Trailblazer Operation undefined method `call' for nil:NilClass

I have a simple Trailblazer Operation as follow: class User::Delete < Trailblazer::Operation extend Contract::DSL contract 'params' do property :token validates :token, presence: true end step Contract::Validate(name:…
Jeremie Ges
  • 2,747
  • 3
  • 22
  • 37
0
votes
1 answer

trailblazer reform gem, how to handle this type of input validation?

We are looking at use the reform gem for validating input. One of the issues we are facing is that we accept input in this format: params = { records: { "record-id-23423424": { name: 'Joe Smith' } "record-id-43234233": { …
Daniel
  • 7,006
  • 7
  • 43
  • 49
0
votes
1 answer

Trailblazer Representable Change Property Name with Variable

I would like to pass in a string variable that will be used as the property name. For example, if I have the variable property_name, which contains a string, I want to do something like this: property :property_name, type: String, getter: ->(_) {…
eclaire211
  • 101
  • 2
  • 12
0
votes
1 answer

Using the Neo4jrb gem, is it possible to use one transaction across multiple blocks

Using the neo4jrb/neo4j gem (8.x), I know it is possible to run multiple queries inside a single transaction like so person = Person.find_by(id: person_id) Neo4j::ActiveBase.run_transaction do |tx| person.update(name: 'New name') …
John
  • 9,249
  • 5
  • 44
  • 76
0
votes
1 answer

Update existing model data

Briefly something about our structure. We use Ruby on Rails on the server side with the Trailblazer Framework. On client side Ember and Ember Engines. Now we have the problem that some models are lying in the father, ie the actual Ember app and some…
0
votes
1 answer

Prepopulate Reform with GET vars

How can you prepopulate a Reform form object with variables from the query string? I understand how to call prepopulate! but how do I access a variable on the URL from within the Reform contract? For example: /example/new?lang=en property…
Greg Olsen
  • 1,370
  • 17
  • 28
0
votes
0 answers

Trailblazer process return in to_json

I am trying to get the result of the process method to be part of the to_json. I've tried overriding the to_json method and introducing a representer. However I can't get access to the return in any of them class TestOperation <…
Decrypter
  • 2,784
  • 12
  • 38
  • 57
0
votes
0 answers

Rails 4: pass parent belongs_to attributes to children

To put my question in context, I have a form that has many fields. Each field can be at the root or a children of another field (hierarchy using Closure Table in my database). I don't have any problem building the hierarchies table, but I have a…
0
votes
1 answer

How can a Trailblazer Operation with Paperdragon process an image sequentially?

In a Trailblazer operation that uses Paperdragon to process an image, code like this is typical: def process(params) validate(params) do |f| f.image!(f.upload) do |v| v.process!(:original) v.process!(:version_a) { |job|…
starfry
  • 9,273
  • 7
  • 66
  • 96
0
votes
3 answers

Cells-4.0.4 : uninitialized constant Cell::Concept (NameError)

Environment: CentOS-6.7 / OSX-10.9.5 Ruby 2.2.3p173 Rails 4.2.5.1 Trailblazer 1.1.0 I am working through the examples in the Trailblazer book mapping them to a current project. I had things working more or less as expected up to the point when I…
James B. Byrne
  • 1,048
  • 12
  • 27
0
votes
1 answer

Q&A. Trailbalzer Testing - Implications of contract method

The following Q&A is based on the examples given in the Trailblazer book pp. ~50-60 as adapted for my specific requirements. You can simply think of ARInvoice and ar_invoice as Thing and thing to get the general drift if following in the book. My…
James B. Byrne
  • 1,048
  • 12
  • 27
0
votes
1 answer

Replacing ActiveRecord with trailblazer

Environment: CentOS-6.7 / OSX-10.9.5 Ruby 2.2.3p173 (probably time for an update) Rails 4.2.5.1 Trailblazer 1.1.0 I am working through the exercises in the trailblazer book and attempting to map elements of an existing project to the examples in…
James B. Byrne
  • 1,048
  • 12
  • 27