About HAsh in ruby


#1

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.


#2

HI Nilesh

Your Question is not clear,

Can you explain with some example

On Sat, Mar 14, 2009 at 6:13 PM, Nilesh K. <


#3

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


#4

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.


#5

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.