fix :restrict_with_error message #10787

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
6 participants

kuboon commented May 29, 2013

Suppose User has_many :posts, klass on this context is Post, not User.
We should call human_attribute_name with the owner.

Do we have any test case related to this? If not, I'd recommend adding one. Thanks.

Member

senny commented Jun 25, 2013

@kuboon ping, did you have time to add the test-case?

Member

senny commented Aug 15, 2013

It's been three months since we last heard from you. I'm closing this but please report back if you are still interested in this change.

@senny senny closed this Aug 15, 2013

@kuboon kuboon deleted the kuboon:patch-1 branch Aug 15, 2013

kuboon commented Aug 15, 2013

I'll retry with proper test cases soon.

Contributor

guigs commented Aug 19, 2014

I found the same problem. It seems others are facing this too, http://stackoverflow.com/questions/25079733/rails-internationalization-record-is-not-being-translated/25385812.

I can confirm that @kuboon solution fixes the problem.

As a workaround one can use:

  activerecord:
    attributes:
      entity: # Should be the parent class when bug https://github.com/rails/rails/pull/10787 is fixed
        entities: 'entidades'
Contributor

guigs commented Aug 19, 2014

Probably must be fixed in has_one_association.rb too.

kuboon commented Aug 20, 2014

Thank you @guigs.

It's difficult for me to add test cases. I hope anyone to write them.

@kuboon kuboon restored the kuboon:patch-1 branch Dec 2, 2014

I've just saw that the issue still happens in Rails 4.2.3

@senny senny reopened this Jul 31, 2015

Member

senny commented Jul 31, 2015

@kuboon @leonardofaria could you add a test-case to this PR to prevent against further regressions?

Contributor

ronakjangir47 commented Sep 11, 2015

@senny I open a PR #21581 with the test cases for both has_many and has_one associations.

@senny senny closed this in #21581 Sep 17, 2015

@kuboon kuboon deleted the kuboon:patch-1 branch Oct 1, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment