I would love a full drop-in answer (hand me a fish), but I this might be a matter of pointing me to where I need to RTFM (teach me to fish). I have a form with a text_area: <%= f.text_area :modified_strategy, :options=>{:cols => 80} %> the string represented by :modify_strategy is comprised of a pattern: <many words>;<more words>;<maybe even more words>; This string is a representation of what was originally three lines with "\n". So to properly render them in a text_area I would want to do something like: gsub(";","\n") and then reverse this in the Model before_save. Unfortunately something as simple as ... :modifed_strategy.gsub(";", "\n") ... returns an error: undefined method `gsub'' for :modified_strategy:Symbol How do I change ";" to "\n" on the string represented by :modified_strategy? Where to next because I guess I''m really missing something about Symbols or Views. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
The :modified_strategy is just a symbol that tells the helper which method to call on your object to get the name/value of the textarea. If you want to manually change the value of the textarea, you can overwrite the value attribute: f.text_area(:modify_strategy , :value => f.object.modify_strategy.gsub(";", "\n"), :cols => 80) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/GmpNEk0o4T4J. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
wonderful. still iffy on this Symbol concept but it seems I am not alone. rtfm! On Fri, Sep 30, 2011 at 9:21 AM, Tim Shaffer <timshaffer-BUHhN+a2lJ4@public.gmane.org> wrote:> The :modified_strategy is just a symbol that tells the helper which method > to call on your object to get the name/value of the textarea. > > If you want to manually change the value of the textarea, you can overwrite > the value attribute: > > f.text_area(:modify_strategy , :value => f.object.modify_strategy.gsub(";", > "\n"), :cols => 80) > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/GmpNEk0o4T4J. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.