-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Engine generator fix #1619
Engine generator fix #1619
Conversation
This change will generate invalid code in case there's no string attribute - it'll just generate code like Current implementation will also generate absurd code if there's no string attribute like |
True. Is there something to do about that? We're not to display text fields or date fields in the index, right? ;) Open to suggestions. |
I was thinking about grabbing first attribute from the list in case there are no string ones. WDYT? |
Great, I'll fix that soon |
Thank you very much ❤️ |
Summoning @parndt |
There seems to be a lot of things that break if there is no string...
|
if we still want to use that, here is new first line of that file: <% title_attribute = (title = attributes.detect { |a| a.type.to_s == "string" }).present? ? title.name : attributes.first.name %> |
I'll try to dig into this tomorrow as I'm starting to feel a bit sleepy. |
It's supposed to use |
@parndt interesting...it crashed for me today when creating a new engine/extension...I'll try to take a look at that when I got some time. |
@jipiboily thanks |
This pull request seems great. |
@parndt iirc this pr wasn't ready to be merged. Main reason being this - "This change will generate invalid code in case there's no string attribute - it'll just generate code like |
I fixed then engine generation of a view that had an hardcoded "title" attribute in it.
Was generated before (line 8):
Now:
ie:
I also removed some code duplication to keep that DRY.