table-for
table-for copied to clipboard
Warning logs when add a html class to an element.
When I want to set an html class to an element...
table.column :data => 'Open', :link => true, :data_column_html => {:class => "text-center"}
I see multiple warning logs (more than 100) with this message:
You are setting a key that conflicts with a built-in method Hashie::Mash#class defined in Kernel. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
This not broke the table but causes a very slow render of the view.
Rails 5.1 table_for 3.6.1
A quick fix it seems to add this line to the gemfile:
gem 'hashie', '~> 3.4.6'
and then execute a bundle update hashie
Hi @havilchis . I am in the process of releasing a complete rewrite of the underlying gem that TableFor is built on top. Once it is officially release, I will be upgrading the TableFor gem and it will no longer be using Hashie::Mash as it's underlying technology and these errors will then completely go away. Thanks for reporting and stay tuned for a new release in the next month or so.
Just reporting that I'm also having this bug.
Great gem btw @hunterae !
Hey @havilchis and @zachfeldman, Apologies it has taken so long and I have not had time yet to wrap up the upgrade to the TableFor gem to use the new Blocks version - I was able to release and document the new Blocks version but my current life looks something like: TWO_YOUNG_KIDS = -FREE_TIME).
I just looked into how hard it would be to fix this issue in the current table-for version and unfortunately, it's not trivial. There is a monkeypatch you can use in an initializer:
class Hashie::Mash
def self.disable_warnings?
true
end
end
Or you can just set the hashie gem version to 3.4.6 as @havilchis indicated.
That's ok!