Calendar Date Select in Ruby on Rails 2.3.5

Calendar Date Select is an excellent date picker for Ruby on Rails.  I didn’t create or figure out any of the following.  This is merely a combination/re-blogging of various other posts, including instructions from the calendar date select home page

  1. Get the gem of calendar date select: ‘gem install calendar_date_select’
  2. Update your project’s environment.rb to include the calendar_date_select gem: ‘config.gem “calendar_date_select” ‘
  3. Unpack the gems to your project.  This is not required but it makes life easier: ‘rake gems:unpack’
  4. Start your server and navigate to your home page to make sure everything is working.
  5. The version in the gem has a line that needs to be updated for Rails 2.3.5.  If you get the error calendar_date_select undefined method `calendar_date_select_includes’ when you start the server and navigate the site you need to update the calendar_date_select file.
    1. Go to project_root\vendor\gems\calendar_date_select-1.16.1\lib and update line 5 of calendar_date_select.rb.
    2. Before Change: if Object.const_defined?(:Rails) && File.directory?(Rails.root.to_s + “/public”)
    3. After Change: if Object.const_defined?(:Rails) && File.directory?(Rails.public_path)
    4. Thanks for this suggestion goes to this guy
  6. In your layout or page add references to the default javascript files and the calendar date select files
    1. Put this one first: <%= javascript_include_tag :defaults %>
    2. <%= calendar_date_select_includes “silver” %>
  7. Check out the calendar_date_select demo page for examples and code snippets.
  8. Another excellent blog post reference from the calendar date select home page
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s