Forum: Ruby on Rails about HAsh in ruby

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.
Nilesh K. (Guest)
on 2009-03-14 14:43
HI ALL,


I want to add values present in hash text_fields on form after form is
displayed. is it possible, how can i do it.
senthil raja (Guest)
on 2009-03-14 18:44
(Received via mailing list)
HI Nilesh

Your Question is not clear,

Can you explain with some example

On Sat, Mar 14, 2009 at 6:13 PM, Nilesh K. <
MaD (Guest)
on 2009-03-14 19:44
(Received via mailing list)
for this text_area:
  <%= text_area( "user", "tasks", :cols=>30, :rows=>10) %>

default value would be to set
  @user.tasks = text_fields[:user_tasks]
in your controller.

hope this is what you were looking for.
Nilesh K. (Guest)
on 2009-03-16 07:01
senthil raja wrote:
> HI Nilesh
>
> Your Question is not clear,
>
> Can you explain with some example
>
> On Sat, Mar 14, 2009 at 6:13 PM, Nilesh K. <

ok

I am fetching value from database and displaying it in text_area
,consider book table.I have three fields in database year,author and
title , 2008,james,me and you is displayed in text_area. now i have hash
which contains different values year,author and title say 2007,john and
happy days. I want to replace values of
year,author and title from text_area with values in hash. how can i do
that?


year     2008
author   james
title    me and you
MaD (Guest)
on 2009-03-16 08:50
(Received via mailing list)
well, you can do that like i posted before.
only thing you have to add is maybe an ajax-call to reload that
textarea.
once you figured how to put default values into that text-area, and
how to replace_html with ajax, this should be no problem. try it.
This topic is locked and can not be replied to.