table-for icon indicating copy to clipboard operation
table-for copied to clipboard

Warning logs when add a html class to an element.

Open havilchis opened this issue 8 years ago • 6 comments

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

havilchis avatar Jul 22 '17 04:07 havilchis

A quick fix it seems to add this line to the gemfile:

gem 'hashie', '~> 3.4.6'

and then execute a bundle update hashie

havilchis avatar Jul 22 '17 04:07 havilchis

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.

hunterae avatar Jul 23 '17 01:07 hunterae

Just reporting that I'm also having this bug.

zachfeldman avatar Aug 03 '17 18:08 zachfeldman

Great gem btw @hunterae !

zachfeldman avatar Aug 03 '17 18:08 zachfeldman

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.

hunterae avatar Oct 16 '17 16:10 hunterae

That's ok!

zachfeldman avatar Oct 17 '17 02:10 zachfeldman