2014-01-25 39 views
1

這裏是我的application.js文件私人酒吧爲什麼尋找一個js文件?

//= require jquery 
//= require jquery_ujs 
//= require foundation 
//= require private_pub 
//= require_tree . 

我private_pub.ru文件

development: 
    server: "http://localhost:9292/tweets/create" 
    secret_token: "secret" 
test: 
    server: "http://localhost:9292/tweets/create" 
    secret_token: "secret" 
production: 
    server: "http://localhost:9292/tweets/create" 
    secret_token: "89e004720af45e61a350a30cf7ee3f50163ca141a02ea130db0b5007a0b75058" 
    signature_expiration: 3600 # one hour 

我的網頁的一部分想要訂閱的頻道

<%= form_for @tweet, url: tweets_path, method: :post, remote: true do |f| %> 
<%= f.text_area :body, id: 'tweet-box', placeholder: "What's goin on..." %> 
<%= f.submit 'tweet', id: 'tweet-btn', class: 'button' %> 
<% end %> 
<div id="map-canvas" /> 
<%= subscribe_to '/'tweets/create' %> 

的create.js .erb文件用於我在tweets控制器中創建的動作

<% publish_to "/tweets/create" do %> 
var swBound_tweet = new google.maps.LatLng(<%= @tweet.location.latitude %>,<%=   @tweet.location.longitude %>) 
var neBound_tweet = new google.maps.LatLng(<%= @tweet.location.latitude %>,<%= @tweet.location.longitude %>) 
var tweet_coords = new google.maps.LatLngBounds(swBound_tweet, neBound_tweet) 
var tweet_overlay = new Tweet(tweet_coords,"<%= @tweet.body %>", window.map) 
<% end %> 

我開始與這個服務器王菲:

bundle exec rackup private_pub.ru -s thin -E development config.ru 

也試圖與

bundle exec rackup private_pub.ru -s thin -E production config.ru 

我得到這個錯誤在瀏覽器控制檯:

GET http://localhost:9292/tweets/create.js 404 (Not Found) 

我在faye服務器日誌中得到這個錯誤:

127.0.0.1 - - [25/Jan/2014 11:16:56] "GET /tweets/create.js HTTP/1.1" 404 767 0.1431 

我已經在提及它的所有文件中多次更改頻道名稱,但我仍然遇到同樣的問題。 我使用:

ruby - 2.0.0 
rails - 3.2.13 
faye - 1.0.1 
private_pub - 1.0.3 

我已經搜查了整個互聯網,但無法找到anything.Please幫助!

+0

我再次弄亂了代碼,似乎有路由問題。 subscribe_to'/ tweets/create'缺少路由,所以我將其更改爲subscribe_to'/ tweets',但我需要一種將請求類型作爲post的方式,因爲只有'/ tweets'和request type = post的組合纔會調用按照資源生成的路線在推文控制器中創建動作:在routes.rb文件中發佈推文 –

+0

請提供「rake routes」的輸出。 – Caffeine

+0

@Caffeine我已經把輸出作爲答案,因爲它太大以至於沒有評論 –

回答

0

我以某種方式解決了這個問題。我在Windows 7上運行我的應用程序,並突然完成它的工作。實際上存在由localhost:9292提供的faye.js文件。 此外,我現在觸發事件從rjs模板