Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Fixed inclusion of helper TextFieldDateHelper into main app #1

Closed
wants to merge 6 commits into from

Conversation

sunkencity
Copy link

TextFieldDateHelper is not included as a helper in the app because it's
not in the helpers directory. Added a workaround for this as I cannot
figure out how to include it from the Engine without moving it into
helpers directory. I don't really get why TextFieldDateHelper is not in the FormtasticBootstrap::Helpers::InputHelper namespace as these methods
seem to be included fine.

The problem manifests when trying to use a datetime
field, which renders the exception: undefined method `text_field_date'
for #<#<Class..."

Or is there some other way of accomplishing this? I'm running rails 3.1.0, perhaps I should update?

TextFieldDateHelper is not included as a helper in the app because it's
not in the helpers directory. Added a workaround for this as I cannot
figure out how to include it from the Engine without moving it into
helpers directory. The problem manifests when trying to use a datetime
field, which renders the exception: undefined method `text_field_date'
for #<#<Class..."
@cgunther
Copy link
Owner

I'm on Rails 3.2.1 and Formtastic 2.1.0-beta1 and if I add a datetime field, I get no error.

Can you post the code that triggers the error message?

@sunkencity
Copy link
Author

What breaks is just trying to have an input for a datetime field, or specifying :as => :datetime

 <%= f.input :foo %>

I tried a vanilla 3.2 app now seems to work fine with rails, but not in my production 3.1 app. When I googled this problem I saw some references as to this error depending on where in the Gemfile it is included so I guess there might be some magic going on. So maybe close this pull request then?

 <%= f.input :foo %>

However there's another problem that I haven't dealt with yet and that is that the name of the field is wrong, the name ought to be post[foo(1i)] or something not post_foo[date].

<input class="small" id="post_foo[date]" name="" type="text" value="2012 February 15" />

@macarthy
Copy link

macarthy commented Mar 7, 2012

I'm getting this error too

undefined method `text_field_date' for #<#Class:0x00000105d84c48:0x00000105d80e40>

My Gemfile :

gem 'rails', '3.2.0'
gem 'mysql2'
gem "high_voltage"
gem 'jquery-rails'
gem 'devise'
gem 'capistrano'
gem 'capistrano-ext'
gem 'passenger'
gem 'exception_notification', :require => 'exception_notifier'
gem 'state_machine'
gem 'carrierwave'

gem 'less-rails-bootstrap'
gem 'formtastic', :git => 'git://github.com/justinfrench/formtastic.git', :branch => '2.1-stable'
gem 'formtastic-bootstrap', :git => 'git://github.com/cgunther/formtastic-bootstrap.git', :branch => 'bootstrap2-rails3-2-formtastic-2-1'

@sunkencity
Copy link
Author

I had problems getting rails to parse the date fields (date and time) automatically so I just switched back to using the vanilla formtastic datetime stuff in my branch. https://github.com/sunkencity/formtastic-bootstrap I'd really like to have a datepicker and stuff but I don't have the time to fix this properly now. There's a datepicker for bootstrap that will hopefully be in the next release, maybe I'll give it a shot then and try to provide it as a patch.

@ollym
Copy link

ollym commented Mar 24, 2012

yea i still have this issue on Rails 3.2.2 - can you please fix?

@sunkencity
Copy link
Author

I'm closing this pull request, should have created a special branch for it. Now everything that I commit ends up here, like the labels fix for bootstrap 2.0.2, which although nice, is out of context.

@sunkencity sunkencity closed this Mar 24, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants