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
- Get the gem of calendar date select: ‘gem install calendar_date_select’
- Update your project’s environment.rb to include the calendar_date_select gem: ‘config.gem “calendar_date_select” ‘
- Unpack the gems to your project. This is not required but it makes life easier: ‘rake gems:unpack’
- Start your server and navigate to your home page to make sure everything is working.
- 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.
- Go to project_root\vendor\gems\calendar_date_select-1.16.1\lib and update line 5 of calendar_date_select.rb.
- Before Change: if Object.const_defined?(:Rails) && File.directory?(Rails.root.to_s + “/public”)
- After Change: if Object.const_defined?(:Rails) && File.directory?(Rails.public_path)
- Thanks for this suggestion goes to this guy
- In your layout or page add references to the default javascript files and the calendar date select files
- Put this one first: <%= javascript_include_tag :defaults %>
- <%= calendar_date_select_includes “silver” %>
- Check out the calendar_date_select demo page for examples and code snippets.
- Another excellent blog post reference from the calendar date select home page