ruby on rails - Datatables + JSON + best_in_place -
i can not add gem best_in_place table.
class_datatable.rb:
def data class.map |record| [ best_in_place(record, :name), best_in_place(record, :short_name) ] end end
there error: nomethoderror (undefined method `best_in_place' classdatatable:0xa9283a44)
my gem file: source 'https://rubygems.org'
# bundle edge rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.4' # use sqlite3 database active record gem 'ruby-oci8' gem 'activerecord-oracle_enhanced-adapter' # use scss stylesheets gem 'sass-rails', '~> 5.0' # use uglifier compressor javascript assets gem 'uglifier', '>= 1.3.0' # use coffeescript .coffee assets , views gem 'coffee-rails', '~> 4.1.0' # see https://github.com/rails/execjs#readme more supported runtimes # gem 'therubyracer', platforms: :ruby # use jquery javascript library gem 'jquery-rails' gem 'jquery-turbolinks' # turbolinks makes following links in web application faster. read more: https://github.com/rails/turbolinks gem 'turbolinks' # build json apis ease. read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.0' # bundle exec rake doc:rails generates api under doc/api. gem 'sdoc', '~> 0.4.0', group: :doc # use activemodel has_secure_password # gem 'bcrypt', '~> 3.1.7' # use unicorn app server # gem 'unicorn' # use capistrano deployment # gem 'capistrano-rails', group: :development #---------------------------------my gems-------------------------------------------------------- #twitter bootstrap gem "therubyracer" gem "less-rails" #sprockets (what rails 3.1 uses asset pipeline) supports less gem "twitter-bootstrap-rails" gem 'client_side_validations' #datatables gem 'jquery-datatables-rails', '~> 1.12.2' gem 'font-awesome-rails' # icons gem 'foundation-rails' # zurb foundation #best in place gem 'best_in_place' #russian langue gem 'russian', '~> 0.6.0' #jquery ui gem 'jquery-ui-rails' #paginate gem 'will_paginate' #-----------------------------------end--------------------------------------------------------- group :development, :test # call 'byebug' anywhere in code stop execution , debugger console gem 'byebug' end group :development # access irb console on exception pages or using <%= console %> in views gem 'web-console', '~> 2.0' # spring speeds development keeping application running in background. read more: https://github.com/rails/spring gem 'spring' end
bundle install done!
if on page:
<% class.all.each |record| %> <%= best_in_place(record, :name) %> <% end %>
that works. however, method not work "def data"
understood! necessary add delegate best_in_place section @ beginning of file class_datatable.rb
Comments
Post a Comment