Skip to content

Conversation

juanmanuelramallo
Copy link

@juanmanuelramallo juanmanuelramallo commented Mar 25, 2024

Allows users to execute ruby code that consumes classes from app/models or any other portion of their app.

This is particularly helpful for creating smart columns for AR enums. i.e.:

# app/models/account.rb
class Account < ApplicationRecord
  enum state: [:pending, :setup, :succeded, :failed]
end

# config/blazer.yml
data_sources:
  main:
    smart_columns:
      account_state: <%= Account.states.to_h {|k,v| [v, k.titleize]}.to_json %>

Without this change, initialization fails with error "uninitialized constant Account (NameError)".

Allows users to execute ruby code that consumes classes
from app/models or any other portion of their app.

This is particularly helpful for creating smart columns for AR enums.
i.e.:

```ruby
 # app/models/account.rb
class Account < ApplicationRecord
  enum state: [:pending, :setup, :succeded, :failed]
end

 # config/blazer.yml
data_sources:
  main:
    smart_columns:
      account_state: <%= Account.states.to_h {|k,v| [v, k.titleize]}.to_json %>
```

Without this change, initialization fails with error "uninitialized
constant Account (NameError)".
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

Successfully merging this pull request may close these issues.

1 participant