Forum: Ruby on Rails Using text_area helper in a partial

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
jak4 (Guest)
on 2009-03-16 16:40
(Received via mailing list)
Hi,

if someone could tell how to work around this.

I'm calling a partial like so:
 render :partial => 'space_line', :locals => {:external_space =>
@new_space.external_space, :space => @new_space}

Within the partial I have the following text_area code:
  text_area( :external_space, :space_comment, :style => "width:
100%", :class => "rich_text_editor")


I assumed the text_area helper would access the local
variable :external_space, but of course does not. Instead it looks for
@external_space. If it doesn't find one, it creates an empty text
area.

Can I somehow provide a local variable, or am I out of luck here?

Best regards
  jak4
Frederick C. (Guest)
on 2009-03-16 16:41
(Received via mailing list)
On Mar 16, 1:45 pm, jak4 <removed_email_address@domain.invalid> wrote:

> I assumed the text_area helper would access the local
> variable :external_space, but of course does not. Instead it looks for
> @external_space. If it doesn't find one, it creates an empty text
> area.
>
> Can I somehow provide a local variable, or am I out of luck here?
>
either assign the local variable to an instance variable (yuck) or use
form for which allows you to bind fields to non-instance variables.

Fred
"Wolas!" (Guest)
on 2009-03-17 12:29
(Received via mailing list)
i am guessing fred wants you to use form_for :)

On Mar 16, 3:40 pm, Frederick C. <removed_email_address@domain.invalid>
jak4 (Guest)
on 2009-03-18 16:50
(Received via mailing list)
I think you are right ;). But since form_for didn't work I went with
the yuck part and hope that nobody will ever find out.
This topic is locked and can not be replied to.