On Jun 17, 2009, at 8:08 PM, E. Litwin wrote:
> If it is just the data that is the issue (as opposed to different
> layouts/views), then filtering the results of the controller.index
> method is the way to go.
>
> On Jun 17, 4:20 pm, dansinker <[email protected]> wrote:
>> I'm developing an app that I want to have switch from its normal
>> weekday view to a weekend-only view (essentially a look at the
>> previous week).
>>
>> While I understand the concept of what I need to do:
>>
>> if the day = saturday or sunday display Y
>>
>> I have no good foothold for the actual code (still learning this
>> stuff).
>>
>> Any help would be huge!
>>
>> Dan

in your controller:

if (1..5).include?(Date.today.wday)
   # set the appropriate variables
   # @daystuff = Stuff.today
   render 'weekday'
else
   # @weekstuff = Stuff.last_week
   render 'weekend'
end

You might be able to use the same view depending on how similar the  
display of the daily stuff and the weekly (weekend) stuff is.

-Rob


Rob Biedenharn          http://agileconsultingllc.com
[email protected]
+1 513-295-4739
Skype:  rob.biedenharn



--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to