check this out:
maybe write something similar yourself (= fix that script with updated code from the plugin) or try to set your default-values to something like "...".
what's your error trace?
try overriding it like that (i just took the code from github and added an if-clause):
def in_place_edit_for(object, attribute, options = {}) define_method("set_#{object}_#{attribute}") do @item = object.to_s.camelize.constantize.find(params[:id]) # adjust the following if-clause to your needs if params[:value].blank? params[:value] = "..." end @item.update_attribute(attribute, params[:value]) render :text => @item.send(attribute).to_s end end
MaD wrote:
try overriding it like that (i just took the code from github and added an if-clause):
def in_place_edit_for(object, attribute, options = {}) define_method("set_#{object}_#{attribute}") do @item = object.to_s.camelize.constantize.find(params[:id]) # adjust the following if-clause to your needs if params[:value].blank? params[:value] = "..." end @item.update_attribute(attribute, params[:value]) render :text => @item.send(attribute).to_s end end
Thanks for the response, can you tell me how I'd use the above code? I've experimented by creating a file called 'extensions.rb' within the lib folder, the doing: require 'extensions' within environment rb. I've tried the method on it's own, followed by placing it within a class wrapper and keep getting errors for 'wrong number of arguments'. My extensions.rb currently looks like this:
[code]class Extensions
ActionController::Macros::InPlaceEditing::ClassMethods.class_eval do def in_place_edit_for(object, attribute) define_method("set_#{object}_#{attribute}") do @item = object.to_s.camelize.constantize.find(params[:id]) # adjust the following if-clause to your needs if params[:value].blank? params[:value] = "..." end @item.update_attribute(attribute, params[:value]) render :text => @item.send(attribute).to_s end end end
end[/code]
Thanks for any help