-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Cannot access resources in show
DSL with same name as HTML tags
#171
Comments
I'm having a similar issue in the dashboard because I have an model named "Label" (it's a fashion site) and it's conflicting with Arbre::HTML::Label ...
returns: undefined method `last' for Arbre::HTML::Label:Class |
For now, this is working for me:
|
Thanks for reporting this. I've moved it into the 0.4.0 release as something to deal with. |
Arbre used to include Arbre::HTML in to the view context. This would include all the tag classes (such as Arbre::HTML::Label) into the view context. This caused clashes if you already had a Label class defined.
Same problem here. |
Fixed in 0.3.0. |
Are you sure this is fixed? I'm having this problem with an Area model in 0.5.0. |
I'm facing the same issue using active admin1.0.0pre The workaround as suggested above worked for me, i.e. first get the object from the assigns hash. show do
_area = assigns[:area]
attributes_table do
# then use _area to access the area object
end
end |
@aleicher no matter what your model is named you can always access it by calling |
Thx. Seems like I missed that one, works great. |
Wow! Had the exact same issue (model named Area) in 2022, checked docs and google'd it with no luck, until I found this issue thread. Cheers @seanlinsley |
When you have a resource with a name that is the same as an HTML tag, like
Article
, then you will not be able to access the resource instance.For example:
When I'm trying to pass
article.body
to mymd
helper method above, the "article" variable is actually an instance ofArbre::HTML::Article
, instead of my ActiveRecord subclass.To work around this, I'm currently doing the following:
But it would probably be good to have some way of handling this more nicely.
The text was updated successfully, but these errors were encountered: