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

strange error #6

Closed
iatfrepo opened this issue May 4, 2023 · 3 comments
Closed

strange error #6

iatfrepo opened this issue May 4, 2023 · 3 comments

Comments

@iatfrepo
Copy link

iatfrepo commented May 4, 2023

Hi Lorin I managed to setup a Ruby app on the Northwind db with Brick and ActiveAdmin. Everything runs fine but after I customized a little models and resources I got this strange issue. If I go to Orders in AA all is fine (see attachment#1) then if I click on the 'brick' icon I get an error (see attachment#2). I also attach a zip with models and resources.

Thank you
Sergio La Marca
2023-05-04 15 00 20 localhost 49508c26a259
2023-05-04 15 01 36 localhost e9cf29347ec7
admin.zip

@lorint
Copy link
Owner

lorint commented May 4, 2023

Oh interesting! If descrips ends up nil then on line 98 right before this it may write out to the terminal:

Caught it in the act for obj / status_id

or something similar. Would be great to see if that's showing up in the terminal.

Have added the orders_status, orders_tax_status, and inventory_transactions tables to a Northwind database and set up the models like you have, and so far mine is working:
Screenshot 2023-05-04 at 16 08 57

Because the word "status" is one of those that pluralises weirdly, I did try setting up an entry in the inflections.rb file to see if that might be part of it:

# config/initializers/inflections.rb
ActiveSupport::Inflector.inflections(:en) do |inflect|
  inflect.uncountable %w(orders_status orders_tax_status)
end

Ended up with a kinda similar error as to what you describe when rendering orders. Looking into pluralisation and such a bit further now.

@lorint
Copy link
Owner

lorint commented May 6, 2023

Heya @iatfrepo -- looks this overly-ambitious set of code designed to set @_brick_model when it is nil was preventing a couple of admin panels from working:

# Had tried: (model_name = (@_brick_model || set_brick_model(args, @_brick_req_params))&.name) || ...
# ... but this caused ActiveAdmin and Avo not to function.

Have dialed this back (thankfully it was never a part of a release, only here in the unreleased code), and also added a little more resilience to #brick_grid so that in the event the belongs_to descriptions are absent, it keeps going instead of having the error surface that you have seen. This has made its way into release 1.0.137 of the gem. To update an existing Rails project, you can run bundle update brick and it should pull this newer version and put it into your Gemfile.lock.

Thanks for your contribution!

@iatfrepo
Copy link
Author

iatfrepo commented May 8, 2023

Hi Lorin great job as always! Thanks.

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

2 participants