{"id":20279877,"url":"https://github.com/goodmeasuresllc/activemodel-error_messages_without_attributes","last_synced_at":"2025-06-30T21:38:34.427Z","repository":{"id":56842154,"uuid":"109022079","full_name":"GoodMeasuresLLC/activemodel-error_messages_without_attributes","owner":"GoodMeasuresLLC","description":"Extends ActiveModel::Errors to allow messages to be generated that do not use the attribute name","archived":false,"fork":false,"pushed_at":"2021-08-11T21:24:00.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-22T15:49:29.503Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GoodMeasuresLLC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-31T16:21:14.000Z","updated_at":"2021-08-11T21:24:03.000Z","dependencies_parsed_at":"2022-09-01T09:02:58.803Z","dependency_job_id":null,"html_url":"https://github.com/GoodMeasuresLLC/activemodel-error_messages_without_attributes","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/GoodMeasuresLLC/activemodel-error_messages_without_attributes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodMeasuresLLC%2Factivemodel-error_messages_without_attributes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodMeasuresLLC%2Factivemodel-error_messages_without_attributes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodMeasuresLLC%2Factivemodel-error_messages_without_attributes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodMeasuresLLC%2Factivemodel-error_messages_without_attributes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoodMeasuresLLC","download_url":"https://codeload.github.com/GoodMeasuresLLC/activemodel-error_messages_without_attributes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodMeasuresLLC%2Factivemodel-error_messages_without_attributes/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262855156,"owners_count":23375278,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T13:33:33.776Z","updated_at":"2025-06-30T21:38:34.405Z","avatar_url":"https://github.com/GoodMeasuresLLC.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ActiveModel::ErrorMessagesWithoutAttributes\n\nExtends ActiveModel::Errors to allow messages to be generated that do not use\nthe attribute name.  Sometimes, you just want to use a custom error message\nwithout jumping through a lot of rails hoops.  With this gem, you specify\nan error message of '^Just use this error' and the attribute name will not be\nincluded in full_error messages for that attribute.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'activemodel-error_messages_without_attributes'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install activemodel-error_messages_without_attributes\n\n## Usage\n\n```ruby\n  class User \u003c ActiveRecord::Base\n    validates :first_name,\n      :presence =\u003e {:message =\u003e 'cannot be blank.'},\n      :length =\u003e {:maximum =\u003e 64, :message =\u003e '^What are you thinking?'}\n\n    validates :last_name, :presence =\u003e true\n  end\n```\n\n### Error messages work the same as the defaults\n\n```ruby\n  user_without_name = User.new\n  user_without_name.valid?\n\n  user_without_name.errors.full_messages_for(:first_name)\n  # [\"First name cannot be blank.\"]\n\n  user_without_name.errors.full_messages_for(:first_name)\n  # [\"Last name can't be blank\"]\n```\n\n### Error messages starting with ^ do not include the attribute\n\n```\n  user_with_too_long_a_name = User.new('a'*65)\n  user_with_too_long_a_name.valid?\n\n  user_with_too_long_a_name.full_messages_for(:first_name)\n  # [\"What are you thinking?\"]\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run\n`rake spec` to run the tests. You can also run `bin/console` for an interactive\nprompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To\nrelease a new version, update the version number in `version.rb`, and then run\n`bundle exec rake release`, which will create a git tag for the version, push\ngit commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/activemodel-error_messages_without_attributes. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the ActiveModel::ErrorMessagesWithoutAttributes project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/activemodel-error_messages_without_attributes/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodmeasuresllc%2Factivemodel-error_messages_without_attributes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoodmeasuresllc%2Factivemodel-error_messages_without_attributes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodmeasuresllc%2Factivemodel-error_messages_without_attributes/lists"}