Skip to content

Conversation

@Inkybro
Copy link

@Inkybro Inkybro commented Aug 18, 2020

This is my attempt at some functionality including that described in #15

I just wanted to take a quick crack at it, so this may not at all be usable, and it may introduce more problems than it solves, I'm not sure.

Let me know what you think, @leastbad (or anyone!) Looking forward to some feedback.

P.S. Sorry, went a little haywire on the code :P


Usage example:

broadcast_errors @account, account_params, email_attributes: { address: 'Email address' }, mobile_attributes: { number: false }

This results in messages like Email address can't be blank for email_attributes[:address], and can't be blank for mobile_attributes[:number].

@Inkybro Inkybro force-pushed the attribute-name-overrides branch from 69d4438 to e62deba Compare August 18, 2020 15:48
@Inkybro Inkybro force-pushed the attribute-name-overrides branch from e62deba to d48b52d Compare August 18, 2020 15:55
@Inkybro
Copy link
Author

Inkybro commented Aug 18, 2020

I just realized that the behavior I was looking for already exists via I18n. I've never really messed much with localization so I wasn't aware of this lol. This ended up being a nice learning experience.

Still, we could add a raw_messages option for those who need it. I'd be happy to open a new PR if desired, just let me know!

@Inkybro Inkybro closed this Aug 18, 2020
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