xscribe-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2013-Jul-24 18:39 UTC
Displaying/Editing data fields shortcut?
I have several pages of data (Customer address info, etc) that I want to minimize the code I have to write to display & edit the fields. I thought of pointing show and edit to the same view, so they use the same html layout. The only difference, is that the text fields are wrapped in a helper function that looks are the controller action to determine if the field is displayed as text, or is an editable item. Would this be considered too much of an ugly hack? -p def tfMacro(cl, member, text, options = {}) (controller.action_name =~ /edit|new|dup/)? (text_field cl, member, options) : "<i>#{text}</i>" end -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/736810bc-2ef9-4eb6-9238-69e4167e556e%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.