I am trying to implement the best_in_place in my rails app and I cannot figure out how to implement it. It just doesnt do anything when I scroll over the text that needs to be edited. I have a nested profile model under Users and I want to edit the Users name. But the name is under the Profile Model. So I have "user.profile.name". I have folowed the installation steps and included and installed the gem and included the jquery files in my application.js as mentioned!
Here is my show view:
<%= best_in_place @profile, :name, :type => :input, :path => user_profile_path(@user) %>
Here is my show action in Users controller:
def show
@user = User.find_by_identifier!(params[:id])
@profile = @user.profile
end
Here is my Profiles controller:
respond_to :html, :json
def edit
@user = User.find_by_identifier!(params[:user_id])
@profile = @user.profile
end
def update
@user = User.find_by_identifier!(params[:user_id])
@profile = @user.profile
@profile.update_attributes(params[:profile])
respond_with @user
end
This is my application.js file
//= require jquery
//= require jquery_ujs
//= require best_in_place
//= require best_in_place.purr
//= require_tree .
$(document).ready(function() {
/* Activating Best In Place */
jQuery(".best_in_place").best_in_place();
});
<%= best_in_place ... %>
. It's certainly a javascript problem. You should check that there is no javascript error at page loading, that the best_in_place javascript file is present, and maybe debug to find what's wrong :-/ – Baldrick