ruby - Best in place gem not updating values - rails 4 -


so have installed best in place gem in rails 4 environment , initialised correctly. (i can click on name field , box becomes editable).

i've code in admin_namespaced user controller

class admin::userscontroller < admin::basecontroller   def index     @users = user.all     # @columns = user.column_names   end    def show     @user = user.find(params[:id])   end    def update     @user = user.find params[:id]      respond_to |format|       if @user.update_attributes(user_params)         format.html { redirect_to(user, :notice => 'user updated.') }         format.json { respond_with_bip(@user) }       else         format.html { render :action => "index" }         format.json { respond_with_bip(@user) }       end     end   end    private      def user_params       params.require(:user).permit(:name,:email,:password,:password_confirmation)     end end 

and want use in conjuction rails datatables gem setup, inline-edit corresponding fields.

this html.erb code in user index view

<% provide(:title, 'all users') %> <h1>all users</h1>  <%= link_to "back", admin_path %> <table class="display responsive no-wrap text-center" id="usertableadmin">   <thead>     <tr>       <th>id</th>       <th>username</th>       <th>email</th>       <th>activated?</th>       <th>admin?</th>     </tr>   </thead>   <tbody>     <% @users.each |user| %>       <tr>         <td><%= user.id %></td>         <td><%= best_in_place user, :name%></td>         <td><%= user.email %></td>         <td><%= user.activated %></td>         <td><%= user.admin %></td>       </tr>     <% end %>   </tbody>  </table> 

here html code looks on tag has best_in_place initialization.

<span data-bip-type="input" data-bip-attribute="name" data-bip-object="user"     data-bip-original-content="example user" data-bip-url="/users/1" data-bip-value="example user" class="best_in_place" id="best_in_place_user_1_name">example user</span> 

i dont know sure reason fields not updated. when click change name gets reverted previous one.

i dont know if because have namespace, admin/users or because index action , not show action.

any insight welcome.

i've found solution,

it seems error update url wrong because of namespace.

what had do, include url parameter below

<td><%= best_in_place user, :name, url: "users/#{user.id}" %></td> 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -