On Martes, 22 de Junio de 2010 04:58:53 JeffS escribió:
> Sergio,
>
> I am making progress. At least the syntax is now correct:
>
> @marked_records =
> Report.find(active_scaffold_session_storage[:marked_records].to_a)

You can use marked_records instead of 
active_scaffold_session_storage[:marked_records], but it isn't important.

>
> Now I need to understand when to initialize the :marked_records
> session storage to nil. If I don't, I get an error like the following:
>
> Couldn't find all Reports with IDs (6,7,8,13,14,9,1,3,10,4) (found 3
> results, but was looking for 10)
>
> where only IDs 1, 3, and 4 actually exist in the db. The other 7 IDs
> existed in the past.

Record.find expects to find all records you ask for. If you don't want an 
exception when some record doesn't exist you can use:
Record.all :conditions => {:id => marked_records.to_a}

>
> If I temporarily insert
>
> active_scaffold_session_storage[:marked_records] = nil
>
> into the controller action definition, it will reset :marked_records
> and it will work, but that's not really the right place to initialize
> the session storage since it wipes out the session when I need it. Can
> you tell me where this should instead go?
>
> Also, I guess I need to re-render the page (or at least the
> marked_records column) after clearing the :marked_records session
> storage- otherwise, the boxes stay checked in the List view when the
> session thinks they're empty. Yet, I can't call Render twice in one
> controller action. So that's another issue I could use a hand with.

You can render a javascript code to index action and it will be refreshed.

>
> I've been working with Rails for a while and still get hung up on the
> simplest things.
>
> Thanks,
>
> Jeff

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Reply via email to