Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 缺少在控制器/模板中调用两个方法_Jquery_Ruby On Rails 3.1 - Fatal编程技术网

Jquery 缺少在控制器/模板中调用两个方法

Jquery 缺少在控制器/模板中调用两个方法,jquery,ruby-on-rails-3.1,Jquery,Ruby On Rails 3.1,我不知道如何使这部分渲染。它将替换中的标识结构。请让我知道,如果这是不够的信息 错误 控制器 tsort.js.erb _tsort.html.erb 控制器 Started GET "/p_sort" for 127.0.0.1 at 2011-08-18 12:35:42 -0500 Processing by AnalyticsController#p_sort as JS Completed 500 Internal Server Error in 5ms ActionView::

我不知道如何使这部分渲染。它将替换中的标识结构。请让我知道,如果这是不够的信息

错误

控制器

tsort.js.erb

_tsort.html.erb

控制器

Started GET "/p_sort" for 127.0.0.1 at 2011-08-18 12:35:42 -0500
  Processing by AnalyticsController#p_sort as JS
Completed 500 Internal Server Error in 5ms

ActionView::MissingTemplate (Missing template analytics/p_sort, application/p_sort with {:handlers=>[:erb, :builder, :coffee, :haml], :formats=>[:js, :html], :locale=>[:en, :en]}. Searched in:
  * "/Users/jess/Sites/shares/app/views"
):
  app/controllers/analytics_controller.rb:435:in `tsort'
  app/controllers/analytics_controller.rb:428:in `p_sort'
  def p_sort
    column = lambda { |a,b| a.percentage <=> b.percentage }
    tsort(column, :reverse)
  end

  def tsort(column, direction = :forward)
    @holdings = session[:holdings]
    @holdings = @holdings.sort! &column
    direction == :reverse ? @holdings = @holdings.reverse! : nil
    respond_to do |format|
      format.js
    end
  end
jQuery('#tab').html("<%= escape_javascript(render(:partial => 'tsort')) %>");
<tr>
    <th><%= link_to('name', '/n_sort', remote: true, class: 'analytics_captable' ) %></th>
    <th><%= link_to('security', '/s_sort', remote: true, class: 'analytics_captable' ) %></th>
    <th><%= link_to('dollars', '/d_sort', remote: true, class: 'analytics_captable' ) %></th>
    <th><%= link_to('shares', '/sh_sort', remote: true, class: 'analytics_captable' ) %></th>
    <th><%= link_to('percentage', '/p_sort'}, remote: true, class: 'analytics_captable' ) %></th>
    <th>transactions</th>
  </tr>
  <% @holdings.each do |holding| %>
   <tr>
    <td><%= holding.name %></td>
    <td><%= holding.security %></td>
    <td><%= number_to_currency holding.dollars  %></td>
    <td><%= number_with_delimiter holding.shares  %></td>
    <td><%= number_to_percentage(holding.percentage, :precision => 2)  %></td>
    <td><%= link_to :details, "/entities/#{holding.entity_id}" %></td>
   </tr>
  <% end %>
  def p_sort
    column = lambda { |a,b| a.percentage <=> b.percentage }
    @holdings = session[:holdings] 
    @holdings = @holdings.sort! &column
    @holdings.reverse!
    respond_to do |format|
      format.js { render 'tsort' }
    end
  end

  def tsort
    respond_to do |format|
      format.js
    end
  end