Skip to content

Need to include ActiveRecord::Reflection for custom form class with 5.2.0 #683

@thimo

Description

@thimo

With release 5.2.0 my app's system tests run into this error:

     ActionView::Template::Error:
       undefined method `reflections' for App::UserForm:Class

I believe this is after this change: #654

App::UserForm is a custom form class I made that loads and saves data from and to a few different ActiveRecord classes. To make this work with validations, so far I've only needed to include ActiveModel::Model:

module App
  class UserForm
    include ActiveModel::Model

    validates :street, :city, :country, presence: true
...

If I also include ActiveRecord::Reflection in my custom form class, the error is gone. What I'm wondering is if this is the right approach, or that maybe bootstrap_form should not rely on reflections being available? Or are there other thoughts for fixing this? And if this is the right approach, should this be documented as a change/solution on the side of bootstrap_form?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions