2012-11-12 4 views
0

datepicker를 레일 3.2.8 응용 프로그램에 추가하려고합니다.Rails DatePicker - Object [object Object]에 'datepicker'메서드가 없습니다.

레일 3+이므로 application.html.erb에 아무 것도 추가하지 않았습니다.

내 application.js은 다음

// This is a manifest file that'll be compiled into application.js, which will include all the files 
// listed below. 
// 
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 
// 
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 
// the compiled file. 
// 
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD 
// GO AFTER THE REQUIRES BELOW. 
// 
//= require jquery 
//= require jquery_ujs 
//= require bootstrap 
//= require_tree . 

$(function(){ 
    $("#transaction_deadline").datepicker(); 
}); 

그리고 뷰에서

/거래/_form.html.erb

내가 가진 : 아직

<div class="field"> 
    <%= f.label :deadline %><br /> 
    <%= f.text_field :deadline %> 
    </div> 

그러나, 날짜 선택기가 '아무튼 일하고주는 :

TypeError: Object [object Object] has no method 'datepicker'

오류

나를 도울 수 있다면 좋을 것입니다. 이 Railscast에 따르면

덕분에,

+0

https://github.com/joliss/jquery-ui-rails 당신이 jQuery를 UI 라이브러리를 가져 오는 당신 =>에게 도움이 될 수 있습니다

//= require jquery.ui.datepicker 

및 application.css에서

? 또는 적어도 datepicker 위젯? –

+0

"<% = javascript_include_tag"응용 프로그램 "%>"코드와 함께 가져 오지 않습니까? – CanCeylan

+0

jQuery 라이브러리와 함께 jQuery UI/datepicker를 가져 오는 중입니까? –

답변

0

, 당신은 당신의 application.js와 application.css 모두 명시 적으로 날짜 선택기 구성 요소를 추가해야합니다. application.js에서

:

*= require jquery.ui.datepicker 
3

어쩌면이 보석

관련 문제