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

compond foreign key to_sym on Array during rake db:migrate #403

Open
MadBomber opened this issue Dec 15, 2022 · 1 comment
Open

compond foreign key to_sym on Array during rake db:migrate #403

MadBomber opened this issue Dec 15, 2022 · 1 comment

Comments

@MadBomber
Copy link

NoMethodError: undefined method to_sym' for ["provider_id", "license_key", "facility_id"]:Array Did you mean? to_s to_set /Users/dewaynevanhoozer/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rails-erd-1.7.2/lib/rails_erd/domain/attribute.rb:81:in block in foreign_key?'

@MadBomber
Copy link
Author

Here is a possible solution ...

      def foreign_key?
        @domain
          .relationships_by_entity_name(@model.name)
          .map(&:associations)
          .flatten
          .map do |associaton|
            result = associaton.send(Domain.foreign_key_method_name)
            if result.class == Array
              result.join("_").to_sym
            else
              result.to_sym
            end
          end.include?(name.to_sym)
      end

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

No branches or pull requests

1 participant