500(内部服务器错误)jquery.js?body = 1:8707

时间:2013-12-11 09:57:14

标签: jquery ruby-on-rails ajax ruby-on-rails-3 ruby-on-rails-3.2

现在我正在尝试设置ajax搜索表单。我的代码不适用于错误消息。

 500 (Internal Server Error) jquery.js?body=1:8707
你可以告诉我如何解决这个问题吗?

☆show.html.erb(members_controller)

             <div class= "form">
             <%= form_tag({:action => "show"}, {:method => "get", :remote => true}) do %>
               <div class="from_field_index">
                <%= text_field_tag 'content' %>
               <%= submit_tag '文検索' %>
              <% end %>
              </div>
            </div>

<% @gmsg_users.each do |gmsg| %> 
<div id="result"></div>
<% end %>

  <script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>

☆members_controller

 @gmsg_users = GroupMessage.where(:group_id => join_groups).order("created_at desc").limit(15)
      @gmsg_users.scoped
      if params[:content].present?
        @gmsg_users = @gmsg_users.where("name like ?" ,  "%" + params[:content]  + "%")

      end

☆show.js.erb

$('#result').html("<%= gmsg.content%>");

☆application.html.erb

<!DOCTYPE html>
<html>
<head>
  <title>Tsundoku Buster</title>
   <%= stylesheet_link_tag    "application", media: "all" %>
    <%= javascript_include_tag "application" %> <!--テキストは:dafaultsに変えよという。-->
    <%= csrf_meta_tags %>
    <link href="/assets/bootstrap.min.css" media="all" rel="stylesheet" />
</head>

☆application.rb中

class Application < Rails::Application

    config.action_view.javascript_expansions[:defaults] = %w(jquery rails)

  end

☆的Gemfile

gem 'jquery-rails'

0 个答案:

没有答案