在宝石文件中
gem 'fancygrid', '2.0.1', :path => 'lib/fgrid'
将源代码从https://github.com/giniedp/fancygrid复制到 lib/fgrid
在控制器中:
@contacts = current_user.contacts.where(:status => 0).page(params[:page]).per_page(15).search(params[:search])
fancygrid_for :contacts, :builder => ContactsGridBuilder, :persist => true do |g|
# specify attributes to display
# g.attributes :email_id, :name
# specify the callback url for ajax loading
g.ajax_url = contacts_path
# finally call find to query the data
g.find do |query|
query.where("user_id = ?", current_user.id).order(:name)
end
得到错误
ActionView::Template::Error (Missing template fancygrid/fancygrid with {:handlers=>[:erb, :builder, :slim, :arb, :coffee], :formats=>[:html], :locale=>[:en, :en]}. Searched in:
* "/home/love/rails/odbf11/app/views"
* "/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activeadmin-0.5.1/app/views"
* "/home/love/.rvm/gems/ruby-1.9.3-p194/gems/kaminari-0.14.1/app/views"
* "/home/love/.rvm/gems/ruby-1.9.3-p194/gems/devise_invitable-1.1.6/app/views"
* "/home/love/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.2.3/app/views"
* "/home/love/.rvm/gems/ruby-1.9.3-p194/gems/maktoub-0.2.5/app/views"
* "/home/love/rails/odbf11/lib/fgrid/app/views"
):
28:
29: <span id="contact_list">
30:
31: <%= fancygrid :contacts %>
32:
33:
34:
lib/fgrid/lib/fancygrid/view/helper.rb:10:in `fancygrid'
app/views/contacts/index.html.erb:31:in `_app_views_contacts_index_html_erb__33025325_105720290'
app/controllers/contacts_controller.rb:27:in `block (2 levels) in index'
app/controllers/contacts_controller.rb:26:in `index'
config/initializers/quiet_assets.rb:7:in `call_with_quiet_assets'
请建议我该怎么做