I am having trouble with getting best_in_place
fully functional. The problem is that once I edit a field, in order to be able to click on and edit that field again I need to refresh the page. I may be wrong, but I have a feeling this has something to do with respond_with_bip
throwing an undefined method
error. I think this has something to do with not putting the best_in_place
assets in the right places. Currently I have the following which works to update 'constant'. But again it's throwing an error when it hits respond_with_bip
:
Show:
<%= best_in_place constant, :description %>
Update action of controller:
def update
@constant = Constant.find(params[:id])
respond_to do |format|
if @constant.update_attributes(params[:constant])
format.html {
flash[:success] = "Constant Updated"
redirect_to settings_path
}
format.json {
respond_with_bip(@constant)
}
else
format.html {
flash[:error] = "Constant Update Failed"
@title = "Constants"
@constant = Constant.new
@partial_path = "settings/constants"
redirect_to settings_path
}
format.json { respond_with_bip(@constant) }
end
end
end
In terms of the folder from best_in_place
's github page, I put the entire lib/best_in_place
folder in my app's app/assets
folder. The javascript files are in app/assets/javascripts
(These are working so not worried about it). And I put the lib/assets/best_in_place.rb
file in the config/initializers
folder.
What am I doing wrong?