1

I've been trying to create a user date-of-birth selection field during sign up. The code looks like this:

<div id="content">
<h3>Register</h3>  
  <%= form_for(@user) do |f| %>
    <div style="width: 374px; margin: 0 auto;">
      <%= f.label :name %>
      <%= f.text_field :name %>
      <div style="clear: both;"></div>
      <%= f.label :email %>
      <%= f.text_field :email %>
      <div style="clear: both;"></div>
      <%= f.label :dob %>
      <%= f.calendar_date_select "e_date" %>
    </div>
  <% end %>
</div>

When I try to load it, rails gives me this error:

undefined method `calendar_date_select' for #<#<Class:0x00000101210208>:0x0000010120d0a8>

What am I doing wrong?

EDIT I installed the calendar_date_select gem using: gem install calendar_date_select I'm running OS X Snow Leopard if it matters.

1
  • 2
    Did you install the calendar_date_select gem?
    – coder_tim
    Commented Oct 20, 2010 at 16:19

1 Answer 1

9
  1. Add to Gemfile:
    gem 'calendar_date_select', :git => 'git://github.com/paneq/calendar_date_select.git'

    Don't use the rails3test branch it is old and was previously merged into master

  2. run bundle install

  3. run rake calendar:install
  4. Add <%= calendar_date_select_includes %> AFTER <%= javascript_include_tag :defaults%> in your layout
  5. Add <%= f.calendar_date_select "calendar" %> to your view
2
  • 1
    shouldn't all executables (such as rake) be run using bundle exec? yehudakatz.com/2011/05/30/… Commented Jun 5, 2012 at 7:22
  • after doing this you should restart the server aswell. At least I got it to work like that after completing the instructions above.
    – marimaf
    Commented Jun 11, 2012 at 5:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.