Hobo / hobo

The web app builder for Rails (moved from tablatom/hobo)
http://hobocentral.net
103 stars 39 forks source link

Tags using conditions options on associations incompatible with Rails 4 #159

Closed stevemadere closed 9 years ago

stevemadere commented 9 years ago

Now that conditions on associations are deprecated in Rails 4, the code for assembling default picklists in <check-many> <select-many> and <select-one> is broken under Rails 4.

I have tested a fix for Rails 4 (using scope instead of conditions) but am not sure if it would be backward compatible to Rails 3. The doc is very obtuse in this particular area.

Basically, my fix depends on associations having a method called 'scope' which returns the scope implied by the conditions option (or actually specified in a lambda under Rails 4)

If there is a backward compatibility problem with my fix, I have a strategy to work around it using a respond_to? check but I prefer not to clutter up the code with that if it is unnecessary.

I'll submit the PR with the simple fix at first and if that does not work under Rails 3, let me know and I'll add the workaround.

iox commented 9 years ago

Fix merged, thanks a lot.