-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for many association validations
This commit adds support for HABTM input validations, where form field `model_ids` may have an associated `:models` validation in the model
- Loading branch information
1 parent
4645082
commit bb21e40
Showing
5 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
class Tag | ||
extend ActiveModel::Naming | ||
extend ActiveModel::Translation | ||
include ActiveModel::Validations | ||
include ActiveModel::Conversion | ||
|
||
attr_reader :id, :title, :description | ||
|
||
def initialize(params = {}) | ||
params.each do |attr, value| | ||
public_send("#{attr}=", value) | ||
end | ||
end | ||
|
||
def persisted? | ||
false | ||
end | ||
end |