Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEP-14877] adds support for Rails 6.1 #2

Open
wants to merge 3 commits into
base: reform126
Choose a base branch
from

Conversation

msxavi
Copy link
Member

@msxavi msxavi commented Feb 26, 2023

No description provided.

NandiniNayak
NandiniNayak previously approved these changes Feb 26, 2023
Copy link
Member

@NandiniNayak NandiniNayak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@mateusdeap
Copy link

@msxavi So, after more testing, we were able to get a good fix for the issue I mentioned in the last call, related to the expense form report.

We just need to also change the contract/errors.rb file like so:

# lib/reform_126/contract/errors.rb
 
  def merge!(errors, prefix)
    if Rails.version > "6.1"
      errors.errors.each do |error|
        add(error.attribute, error.type, message: error.message)
      end
    else
      # TODO: merge into AM.
      errors.messages.each do |field, msgs|
        unless field.to_sym == :base
          field = (prefix+[field]).join(".").to_sym # TODO: why is that a symbol in Rails?
        end

        msgs = [msgs] if Reform126.rails3_0? # DISCUSS: fix in #each?

        msgs.each do |msg|
          next if messages[field] and messages[field].include?(msg)
          add(field, msg)
        end # Forms now contains a plain errors hash. the errors for each item are still available in item.errors.
      end
    end
  end

I can add the commit, if you want.

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

Successfully merging this pull request may close these issues.

3 participants