Open bugzbrown opened 4 days ago
I've just tried reproducing this in a new Rails (8.0) app and wasn't able to. The only thing that I notice in your code that could be a cause is the trailing comma on your item
line:
Trestle.resource(:date_bulk_update, model: InvoiceGroup) do
menu do
- item :date_bulk_update,
+ item :date_bulk_update
end
# everything else is commented
end
If that doesn't help, could you please post the full error trace and your Trestle/Rails versions.
I am really not sure what exactly is going on here, and I am pretty sure this is the edge case of the edge case scenarios.
I am implementing trestle in a legacy project here. I have dozens of models that are pretty much all related. We are adopting the use of Trestle focused on behavior rather than on "entities". What do I mean by that? We have several "admins" focused on specific actions we want users to take. (Example: I have an action which is "edit the user's address" - this links to customer/address_admin.rb and my form only allows users to alter address details)
OK so everything was going fine... My resources are all working beautifully with initializing them with
Trestle.resource(:block_name, [scope: SomeScope], model: SomeModel)
I mean, until I ran into a problem with a specific Model.Causes my server to crash. In the logs, the crash seems to be in app/models/invoice_group.rb and the next couple of lines suggest it has something to do with scopes in ActiveRecord
these are my scopes
Funny/Odd things:
Depending on how I instance InvoiceGroup:
This Crashes:
This Works:
If I comment or rename my scopes, my server spins up correctly
THIS CRASHES MY SERVER
EITHER WORKS
Any idea of what may be going on?