albertopq / jquery_datepicker

Rails 3 plugin that allows you to select dates from a calendar
91 stars 60 forks source link

f.datepicker produces an error #34

Closed arthwood closed 10 years ago

arthwood commented 11 years ago

I have in haml template:

= f.datepicker :voucher_expires_at

but it gives:

wrong number of arguments (1 for 2)

as if it would expect:

= f.datepicker :shop, :voucher_expires_at

which actually works, but syntactically makes no sense and doesn't set proper value of text_field unless I use:

= f.datepicker :shop, :voucher_expires_at, :dateFormat => "yy-mm-dd", :value => f.object.voucher_expires_at.to_s

Maybe it conflicts with other gems? My Gemfile:

gem 'haml' gem 'uglifier' gem 'execjs' gem 'therubyracer', :platform => :ruby gem 'acts-as-taggable-on' gem 'rinku', :require => 'rails_rinku' gem 'authlogic' gem 'jquery-rails' gem 'jquery_datepicker' gem 'paperclip' gem 'kaminari' gem 'dynamic_form' gem 'galetahub-simple_captcha', :require => 'simple_captcha', :git => 'git://github.com/galetahub/simple-captcha.git' gem 'money' gem 'quiet_assets'

albertopq commented 11 years ago

Hi there!

= f.datepicker :voucher_expires_at 

should work without problems.. Could you post a gist (https://gist.github.com) with the whole view?

Thanks!

hale commented 11 years ago

I possibly have the same issue, except with a slightly different error: wrong number of arguments (1 for 0)

This might be because I'm using Rails 4 & Ruby 2, however. I forked this repo in an attempt to make it compatible - it may be an issue with that.

https://github.com/hale/jquery_datepicker/commit/5219d1defd62cf4ccc447ee4f7eeb5de00a6e052

Here's the full view:

https://github.com/hale/budgeter/blob/master/app/views/transactions/_form.html.haml

hale commented 11 years ago

Okay it's bound to be different - missed that the OP made the issue 7 months ago. I'm attempting to make this compatible with Rails 4 anyway - i'll make a new thread.

arthwood commented 11 years ago

@albertopq here's the gist: https://gist.github.com/arthwood/5890816 I reduced it to minimum so it's simple as that. The project is in Rails 3.2.10. I'll try to upgrade to 11 or remove some other gems since they may be in conflict with jquery_datepicker

albertopq commented 11 years ago

That's weird... this test just try to check that case:

https://github.com/albertopq/jquery_datepicker/blob/master/spec/jquery_datepicker_spec.rb#L223

I don't think Rails 3.2.10 is the problem, probably the conflict with another gem is the case. It's not going to be easy to reproduce for me, so if you can try to minimize the use case (reducing gems), I'll be glad to help.

Thanks!

albertopq commented 11 years ago

Might have something to do with HAML? Could you please try to use ERB instead, just for testing?

arthwood commented 11 years ago

ok, got it, here's the source of the issue:

gem 'galetahub-simple_captcha', require: 'simple_captcha'