Skip to content
This repository was archived by the owner on Jun 21, 2018. It is now read-only.

Rails 3.2; Is a config/initializers/calendar_date_select file needed? Am I doing it right? #37

@jzellman

Description

@jzellman

Hi,

I'm in the process of upgrading an app from Rails 2.3 to 3.2. In order to get the plugin working correctly I had to do the following:

Add calendar date select to the Gemfile:

gem 'calendar_date_select', '2.0.0', 
    :git => 'git://github.com/timcharper/calendar_date_select.git'

Add the following to my layout/application (for silver style):

<%= stylesheet_link_tag 'calendar_date_select/silver'  %> 
<%= javascript_include_tag 'calendar_date_select/calendar_date_select' %>

Add the css and js assets to the asset pipeline in config/application.rb:

config.assets.precompile += ['calendar_date_select/*.css', 'calendar_date_select/*.js'] 

Create the file config/initializers/calendar_date_select.rb with the following:

require 'calendar_date_select'    
ActionView::Helpers::FormHelper.send(:include, CalendarDateSelect::FormHelpers) 
ActionView::Base.send(:include, CalendarDateSelect::FormHelpers)   
ActionView::Base.send(:include, CalendarDateSelect::IncludesHelper) 

Without the config/initializer/calendar_date_select.rb file, the calendar_date_select helper method is no longer available in the views:

undefined method `calendar_date_select'

So my question is... is a config/initializer file required? Is there a better way to get the helpers loaded in the ActionView context?

Thanks,

Jeff

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions