开发者

Rails suddenly needs an template.. when its there?

I've been setting up views acquiesced with AJAX all afternoon, and suddenly one of them snags and gives me this error :

ActionView::MissingTemplate (Missing template tabs/tabs_result.erb in view path app/views:vendor/plugins/rails-ckeditor/app/views):

Strange..

my routes

organization.resources :tabs, :collection => {:tabs_result => :get}

produces this route:

 tabs_result_organization_tabs GET    /organizations/:organization_id/tabs/tabs_result(.:format)

I've never needed an action in the controller so I just skip that.

I have a file here /tabs/tabs_result.js.haml

And I call it with开发者_JS百科 this line :

= link_to tab.title, tabs_result_organization_tabs_path(organization, tab), :class => 'show-result'

Anyone know why that error is popping up ?

I thought I would also point out that if I renamed the file it tabs_result.js.erb even though its not, and I don't want it to be, it gives me this error :

ActionController::UnknownAction (No action responded to tabs_result. Actions: create, destroy, edit, edit_order, new, show, update, and update_order):


You need to tell the rails that you're requesting an Ajax response.

I'm assuming you're trying to render the response after a "click" event.

So to all your links you could add a class called "ajaxLink" and add the following jQuery code

$(document).ready(function(){
  $("a.ajaxLink").live("click", function(){
    $.getScript($(this).attr("href"));
    return false;
  });
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜