That did the trick. Thanks Fred!! Brian Burridge Agile Nomads www.rubyrailsreview.com
On Feb 4, 12:46 pm, Frederick Cheung <[email protected]> wrote: > On 4 Feb 2009, at 17:40, [email protected] wrote: > > > > > I am using some code for in place JS editing with validation, that > > worked up until Rails 2.2. After upgrade, the method can't be find, so > > apparently its not overridge the right class or isn't being included > > as before. It is currently being included via a require statement in > > environment.rb. The code is below. Any suggestions? > > Maybehttp://www.spacevatican.org/2008/11/21/environment-rb-and-requiring-d... > ? > > Fred > > > Brian Burridge > > Agile Nomads > >www.rubyrailsreview.com > > > -- code -- > > > module ActionController > > module Macros > > module CustomInPlaceEditing > > def self.included(base) > > base.extend(ClassMethods) > > end > > > module ClassMethods > > def in_place_edit_with_validation_for(object, attribute) > > define_method("set_#{object}_#{attribute}") do > > klass = object.to_s.camelize.constantize > > �...@item = klass.find(params[:id]) > > �[email protected]("#{attribute}=", params[:value]) > > if @item.save > > render :update do |page| > > page.replace_html("#{object}_#{attribute}_#{params[:id]} > > _in_place_editor", > > @item.send(attribute)) > > end > > else > > render :update do |page| > > page.alert(@item.errors.full_messages.join("\n")) > > klass.query_cache.clear_query_cache if > > klass.method_defined?:query_cache > > @item.reload > > page.replace_html("#{object}_#{attribute}_#{params[:id]} > > _in_place_editor", > > @item.send(attribute)) > > end > > end > > end > > end > > end > > end > > end > > end > > > ActionController::Base.class_eval do > > include ActionController::Macros::CustomInPlaceEditing > > end > > > module ActionView > > module Helpers > > class InstanceTag > > def to_content_tag(tag_name, options = {}) > > content_tag(tag_name, html_escape(value(object)), options) > > end > > > end > > end > > end --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

