HashWithIndifferentAccess on all Time inputs

31 views
Skip to first unread message

tonym

unread,
Nov 19, 2012, 5:25:27 PM11/19/12
to hobo...@googlegroups.com
Not sure if this is a bug in pre5, but since I upgraded I'm getting this on all my time fields, on 'create's only.
Date/Time fields are working fine, and editing time fields works fine too.  But if I create a new record from any form with a time field in it, the database stores (e.g.):
!ruby/hash:ActiveSupport::HashWithIndifferentAccess year: '2012' month: '11' day: '19' hour: '22' minute: '03'
in the time fields.

Some of these forms are very simple, no validation.
e.g.

  fields do
    name :string
    event_date :date
    start_time :time
    end_time :time
    timestamps
  end

with standard hobo permissions and nothing else in the model.

On hobo 2.0.0 pre5  rails 3.2.8
Any thoughts?

Cheers, Anthony.

Bryan Larsen

unread,
Nov 19, 2012, 5:43:29 PM11/19/12
to hobo...@googlegroups.com
The big difference with pre5 is that the hobo-jquery-ui datepicker now
respects date.formats.default in your internationalization settings.
Try installing the delocalize gem to see if that helps.

Bryan
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/i7UbUg7oJK4J.
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to
> hobousers+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.

tonym

unread,
Nov 19, 2012, 6:05:21 PM11/19/12
to hobo...@googlegroups.com
Thanks Bryan,
I've tried installing delocalize, but no difference.  There is no datepicker in use here.  The date in the example is a standard rails date prompt, and that works fine anyway. It is the two :time fields that get HashWithIndifferentAccess.  And only on create - editing works fine on those fields too.

Thanks, Anthony.

Bryan Larsen

unread,
Nov 19, 2012, 6:08:18 PM11/19/12
to hobo...@googlegroups.com
OK, I'll check it out. Do datetime fields work? I presume they're
just as broken...

Bryan
> https://groups.google.com/d/msg/hobousers/-/AQyOx8xvYGcJ.

tonym

unread,
Nov 19, 2012, 6:15:39 PM11/19/12
to hobo...@googlegroups.com
Hi Bryan,
just tested, yes same result.

Regards, Anthony.

Matt Jones

unread,
Nov 19, 2012, 7:26:09 PM11/19/12
to hobo...@googlegroups.com

On Nov 19, 2012, at 5:25 PM, tonym wrote:

> Not sure if this is a bug in pre5, but since I upgraded I'm getting this on all my time fields, on 'create's only.
> Date/Time fields are working fine, and editing time fields works fine too. But if I create a new record from any form with a time field in it, the database stores (e.g.):
> !ruby/hash:ActiveSupport::HashWithIndifferentAccess year: '2012' month: '11' day: '19' hour: '22' minute: '03'
> in the time fields.

Looks like it's sending the nested data in the format we used in 1.x, not in the multiparameter-assignment format that the Rails helpers send. Do you happen to have any old taglibs hanging around?

--Matt Jones

Bryan Larsen

unread,
Nov 20, 2012, 2:23:41 PM11/20/12
to hobo...@googlegroups.com
It appears that our attributes_with_hobo_type_conversion= monkey patch
is no longer being called on create.

I could fix that, but it seems like a better idea just to get rid of
the monkey patch completely.

To do so, I'll switch from using the `select_datetime` helper to the
`datetime_select` helper. This may cause problems for some people,
because the parameter name will change from something like
foo[bar][year] to something like foo[bar(1i)]

This would be a breaking change very late in our development cycle,
but I think it's best to do it now before we hit the 2.0 mark.

thoughts?
Bryan

Bryan Larsen

unread,
Nov 20, 2012, 2:46:39 PM11/20/12
to hobo...@googlegroups.com
I pushed a fix to github. Please check it out.

Bryan

tonym

unread,
Nov 22, 2012, 7:47:20 AM11/22/12
to hobo...@googlegroups.com
Hi Bryan,
thanks for this.  Will give it a try soon.  At the moment I've rolled back, so I can get a project finished.

Anthony.
Reply all
Reply to author
Forward
0 new messages