-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow referencing custom columns on new accounts
When using `ActiveRecord::Base.instantiate`, accessing a column attribute that wasn't present in the given hash will raise a ActiveModel::MissingAttributeError. This is not problematic for retrieving existing accounts, as the `account` hash will have all the columns, but it is for new accounts. This allows things like running model validations in a `before_create_account` hook instead of Rodauth validations, which is especially useful when migrating existing authentication to Rodauth.
- Loading branch information
Showing
5 changed files
with
20 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require "test_helper" | ||
|
||
class ModelTest < IntegrationTest | ||
test "allows referencing custom columns for new accounts" do | ||
visit "/create-account" | ||
fill_in "Login", with: "[email protected]" | ||
fill_in "Password", with: "supersecret" | ||
fill_in "Confirm Password", with: "supersecret" | ||
click_on "Create Account" | ||
end | ||
end |
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