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

A copy of AttributeProvider has been removed from the module tree but is still active #14

Open
ck2000 opened this issue Dec 29, 2018 · 0 comments

Comments

@ck2000
Copy link

ck2000 commented Dec 29, 2018

Iam getting an ArgumentError in Excption in row "CustomerAttribute.where(company_id: model.company_id)" of the following code. What I am trying to do is load dynamic attributes per each customer. My AttrivuteProvider is located at rails_root/lib/attribute_provider.rb
How can I solve this issue?

class
 AttributeProvider
  def initialize(model)
    @model = model
  end
  CustomerAttribute.where(company_id: model.company_id).map do |field|
      ActiveDynamic::AttributeDefinition.new(field.name,
                                             datatype: 2, #field.datatype,
                                             required: field.required,
                                             default_value: field.default_value)
    end
  end
private
  attr_reader :model
end
ActiveDynamic.configure do |config|
  config.provider_class = AttributeProvider
  config.resolve_persisted = Proc.new { |model| model.is_a?(Employment) ? true  : false }
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