Q:

Rails In line edit

How can I edit the following below in the index page? I would like to be able to inline edit and update the following the view has the index action 
<% @request.each do |s| %>
  <%= s.message %>
  <%= s.date %>
<% end %> 

Tried the gem best in place but i doesnt seem to work so whenever i tried 
 <%= best_in_place @request, :message %> it throws an error of unknown method :message. Isnt this <%= best_in_place @request, :message %> the same with this  <%= s.message %> 
Does best in place work in rails version 5.1.4 and how can I make the inline edit to work ? 

A:

Does best in place work in rails version 5.1.4 and how can I make the
  inline edit to work ?

Yes, it works, you need jQuery and to add the gem and JS libraries.
For jQuery:
$ yarn add jquery

Then in your application.js file:
//= require jquery

For best_in_place, add the gem in the Gemfile:
gem 'best_in_place', '~> 3.0.1'

Then the library in your application.js file:
//= require jquery
//= require best_in_place
...

$(document).ready(function() {
  /* Activating Best In Place */
  jQuery(".best_in_place").best_in_place();
});

You see the best_in_place js right after jquery, and the initialization in the same file - you must add //= require_tree . for initializing in the same file.
Then in your view you need to pass the object and the attribute:
<% @request.each do |request| %>
  <%= best_in_place request, :message %>
  ...
<% end %> 

