Becca Girl | 23 May 23:33

Re: help needed with where and how best to set a param


AndyV wrote:

> @order = params[:id].nil? ? Order.new : Order.find_by_id(params[:id])
> 

I'm working on this with many other projects so I'm slow to getting the 
code in to test.

I implemented the above code, but here's where the other gotcha comes in 
when I have a new order.  Right now in my drag and drop, I've got a div 
that displays all of the selected items.  When I drag items there now, 
it replaces whatever I have previously selected with the new dragged 
item.  Now I know this is due to how I have it set up.  I've got the 
partials and controllers hitting the database each time an item is 
selected.  I save the value in the order and then call it back to show 
the selected items.

It seems to me that I'm going to need to create a persistent variable 
that will contain the string of values of the item id's.  But the other 
gotcha in this is that when an item is selected, it is removed from the 
list of available options.  This makes it more user friendly so someone 
can see what they've chosen.

Any thoughts on this one?  Again, this works great when I'm editing a 
record because I can save to the existing order, not so great with new 
orders.

THANKS!!!
--

-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Gmane