You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My Foo model has a method called bar that returns a Bar model instance (or nil).
It is technically not a has_one association though because there is not foreign key. Rather the bar method uses some business logic to determine which Bar to return.
In the Foo dashboard, what "type" should I use for the bar attribute?
I found that I can use the "Field::HasOne" with the class_name option but that option is deprecated:
bar: Field::HasOne.with_options(class_name: "Bar"),
If I omit the class_name option Administrate crashes because (I think) it can't determine the type via reflection.
bar: Field::HasOne,
Thanks.
The text was updated successfully, but these errors were encountered:
We tried to remove `:class_name` (along with some others), as it didn't
seem like they had a legitimate use as of thoughtbot#2384 and thoughtbot#2546. But we've
been seeing various cases where it's still helpful to have.
Closesthoughtbot#2384.
We tried to remove `:class_name` (along with some others), as it didn't
seem like they had a legitimate use as of #2384 and #2546. But we've
been seeing various cases where it's still helpful to have.
Closes#2384.
My
Foo
model has a method calledbar
that returns aBar
model instance (or nil).It is technically not a
has_one
association though because there is not foreign key. Rather thebar
method uses some business logic to determine whichBar
to return.In the
Foo
dashboard, what "type" should I use for thebar
attribute?I found that I can use the "Field::HasOne" with the
class_name
option but that option is deprecated:If I omit the
class_name
option Administrate crashes because (I think) it can't determine the type via reflection.Thanks.
The text was updated successfully, but these errors were encountered: