Displaying 2 results from an estimated 2 matches for "archive_year".
Did you mean:
archive_tar
2006 Mar 25
4
dynamic set_table_name for achives
How can I pass something to set_table_name so that I can switch tables
on the fly for accessing archive data?
If I could access sessions inside a model I would do something like:
if @session[:current_period]
set_table_name "statistics_" + @session[:archive_year]
else
set_table_name "statistics_" + Date.now.year
end
But since I cannot access the session from within a model how do I tell
the model to archive data which is held in a different table eg.
"statistics_2005" ?
Many thanks, K.
--
Posted via http://www.ruby-forum.com/.
2006 Mar 25
1
Re: Rails Digest, Vol 18, Issue 656
...gt;
> How can I pass something to set_table_name so that I can switch tables
> on the fly for accessing archive data?
>
> If I could access sessions inside a model I would do something like:
>
> if @session[:current_period]
> set_table_name "statistics_" + @session[:archive_year]
> else
> set_table_name "statistics_" + Date.now.year
> end
>
> But since I cannot access the session from within a model how do I tell
> the model to archive data which is held in a different table eg.
> "statistics_2005" ?
>
>
> Many thanks, K....