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
and those options are persisted in the @options instance variable of the Administrate::Field::String object that is available in views.The problem I have is that, @options is exposed through a attr_reader under the protected section of the class, so I can't "safely" access it. I know that I can access options via attribute.send(:options), but I'd prefer to only rely on public methods.
Passing arbitrary options provides flexibility to attribute definitions, allowing me to override less views, and lowering my maintenance burden, both things I like. 🎈 🤡
Is there a significant reason why options should remain protected and not part of the public interface?
Thanks!
The text was updated successfully, but these errors were encountered:
I'm not sure why providing access to options is considered undesirable. It seems that part of the goal is to encourage you to subclass the core Field classes. See #612.
Subclassing core fields is all well and good, but allowing us to customize core fields via options and/or modifying templates seems to be a concern at odds with trying to encourage us to subclass them.
When defining an attribute in a dashboard, I can pass arbitrary options parameters to the
with_options
method, such asand those options are persisted in the
@options
instance variable of theAdministrate::Field::String
object that is available in views.The problem I have is that,@options
is exposed through aattr_reader
under theprotected
section of the class, so I can't "safely" access it. I know that I can access options viaattribute.send(:options)
, but I'd prefer to only rely on public methods.Passing arbitrary options provides flexibility to attribute definitions, allowing me to override less views, and lowering my maintenance burden, both things I like. 🎈 🤡
Is there a significant reason why options should remain protected and not part of the public interface?
Thanks!
The text was updated successfully, but these errors were encountered: