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.
C47e75cdd405c006fb3a3a0cae147302?d=identicon&s=25 Nilesh Kulkarni (nilk_cse)
on 2009-03-14 13: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.
4f4bd568475b3af7db5f27aacdeab2ec?d=identicon&s=25 senthil raja (Guest)
on 2009-03-14 17: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 Kulkarni <
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-03-14 18: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.
C47e75cdd405c006fb3a3a0cae147302?d=identicon&s=25 Nilesh Kulkarni (nilk_cse)
on 2009-03-16 06: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 Kulkarni <

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
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-03-16 07: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.