Huh... I wasn't aware that there was a better way of messing with methods. Would you be willing to do the same treatment for the other two methods in ActionViewMods?
In general, attaching a patch file is better than pasting it into an email, because then it doesn't get auto-formatted. - Nathan [EMAIL PROTECTED] wrote: > Hi guys, > > I noticed today that haml seems to override simply_helpful's form > helpers, so: > > - form_for Person.new do |f| > = f.text_field :name > > fails. > > I looked at it a bit, and think the problem is that > action_view_mods.rb is aliasing form_for before simply_helpful > modifies it -- probably because "haml" is alphabetically before > "simply_helpful" and plugins are probably included in lexical order. > > Anyhow, I've written a patch that solves this for me; it uses > alias_method_chain() like simply_helpful does; is just posting it at > the bottom of this message a good way to send it for review? > > Thanks! > -Nate > Wendt Library > UW - Madison > > --- action_view_mods.rb (revision 57) > +++ action_view_mods.rb (working copy) > @@ -12,8 +12,6 @@ > class ActionView::Base > alias_method :old_concat, :concat unless > instance_methods.include? "old_concat" > alias_method :old_form_taThis definitely looks like something worth > including. g, :form_tag unless > instance_methods.include? "old_form_tag" > - > - alias_method :old_form_for, :form_for unless > instance_methods.include? "old_form_for" > end > > module Haml > @@ -59,7 +57,7 @@ > res > end > > - def form_for(object_name, *args, &proc) # :nodoc: > + def form_for_with_haml(object_name, *args, &proc) # :nodoc: > if block_given? && is_haml? > oldproc = proc > proc = bind_proc do |*args| > @@ -68,13 +66,14 @@ > tab_down > end > end > - old_form_for(object_name, *args, &proc) > + form_for_without_haml(object_name, *args, &proc) > concat "\n" if block_given? && is_haml? > end > > def generate_content_class_names > controller.controller_name + " " + controller.action_name > end > + alias_method_chain :form_for, :haml unless > instance_methods.include? "form_for_with_haml" > end > end > end > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Haml" 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/haml?hl=en -~----------~----~----~----~------~----~------~--~---
