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

Use Show Page Attributes When Rendering a has_one Relationship On Another Record's Show Page #1259

Merged
merged 1 commit into from
Oct 5, 2020
Merged

Use Show Page Attributes When Rendering a has_one Relationship On Another Record's Show Page #1259

merged 1 commit into from
Oct 5, 2020

Conversation

conradbeach
Copy link
Contributor

When rendering a has_one relationship on the show page for a record, we're presently displaying the form attributes of the child record (as defined in the FORM_ATTRIBUTES constant from the child record's dashboard file).

I think it makes more sense to use the child record's show page attributes (as defined in the SHOW_PAGE_ATTRIBUTES constant from the child record's dashboard file). That just fits better when rendering a record on a show page.

Furthermore, using the form attributes can lead to displaying odd attributes such as "Password Confirmation".

This pull request makes the necessary changes to use the show page attributes of the child record instead of the form attributes.

It also makes use of the render_field helper to render each field a little more nicely than the raw data rendering we're doing right now.

Current
snip20181207_5_edited

Changed by This Pull Request
snip20181207_8

@nickcharlton nickcharlton added feature new functionality that’s not yet implemented models models, associations and fetching the underlying data labels Jan 2, 2020
On the show page for a record, we were previously displaying the form
attributes when rendering the child of a has_one relationship.

This makes us display the show page attributes, fitting better when rendering
a record on a show page.

Furthermore, using the form attributes can lead to displaying odd attributes
such as "Password Confirmation".
@nickcharlton
Copy link
Member

Thanks for your contribution and I'm sorry that it took so long before we got around to merging it!

@nickcharlton nickcharlton merged commit eda8f53 into thoughtbot:master Oct 5, 2020
@conradbeach
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature new functionality that’s not yet implemented models models, associations and fetching the underlying data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants