本文介绍了错误说"自动完成的方法不存在"与Rails3中,自动完成宝石的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Rails应用程序,我试图用Rails3中,jquery的,自动完成宝石。
我包含在Gemfile中以下行。
宝石Rails3中-的jQuery-自动完成,给了捆绑安装及其在宝石中列出。

In my rails application I am trying to use rails3-jquery-autocomplete gem.I included the following line in Gemfile.'gem rails3-jquery-autocomplete' and gave bundle install and its listed in the gems.

我的控制器:

class ReleasesController < AuthorizedController
  # GET /releases
  # GET /releases.xml
    autocomplete :users, :name

     def new
    @release = Release.new
    @ic_ids = params[:ic_ids] ? params[:ic_ids] : []
     @testers = User.find_by_sql("select * from users where id in(select user_id from user_role_assignments where role_id in (select id from roles where name like 'Tester')) order by name").paginate(:page=>params[:page],:per_page=>30)
   if params[:project_id]
      @release.project = Project.find(params[:project_id])
    end
    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @release }
          end
  end

  end

路线文件:

get 'releases/autocomplete_users_name'

查看文件:

= autocomplete_field_tag 'tester_name', '', users_autocomplete_user_name_path, :size => 75

我收到错误

undefined method `autocomplete' for #<ReleasesController:0xb731e2c0>

请帮我在这里。

谢谢,
Ramya。

Thanks,Ramya.

推荐答案

你运行的发电机?
轨生成自动完成:安装

和控制器内它应该是

 Class SomeController
 autocomplete :user, :name
   def yourmethods
   end
 end

请看看这里的说明:

这篇关于错误说&QUOT;自动完成的方法不存在&QUOT;与Rails3中,自动完成宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 06:37