Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Problem with array
Fernando Jesus
6/27/2008 6:35:00 PM
Hi everybody well still im a newbie in this of ruby but i try to do my
best for can solve my problem but this time im stuck in this i hoe you
can help me
IN A REDUCE WAY:
how can i send the array that is write in the model for can manipulate
it and can store in another table well any suggestion will be very
helpfull
IN A LONG WAY:
Well the problem is that i use the example of agile web development for
use the sessions in the shopping cart
So when i add or remove data in my session or my array , cause in the
model i have write something like this:
attr_reader :books
def initialize
@books=[]
end
def add_tabla(tabla)
current_book=@books.find{|u| u==tabla}
if current_book
@books.delete(current_book)
else
@books<<tabla
end
end
so in @books (array) i have the data, so here it comes my problem, i
need to send all the data stored in the array for another controller for
store in a new table, i have a view:
<% form_tag :controller=>'table',:action=>'send',:id=>@user.books do-%>
<tr><th><h1>choosen books</h1></th></tr>
<tr>
<th>Title</th>
<th>Autor</th>
<th>CB</th>
</tr>
<--! here is where i print on the view the data of the array in the
model-->
<% for log in @user.books%>
<tr>
<td><%=h(log.title)%></td>
<td><%=h(log.autor)%></td>
<td><%=h(log.codbar)%></td>
</tr>
<%end%>
<tr>
<td><span class="Estilo1"><%=link_to_close_redbox "close"%></td></tr>
<tr>
<p><th align="left"><%=submit_tag 'Send'-%></th></p>
</tr>
</table>
<%end-%>
What im trying to do is send the array to another control for can manage
and store in a new table.
So how can i send in the correct way the array, cause when i read about
params i can see that is a hash =S =S =S =S =S
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Problem with array
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password