Thanks a lot, Ignacio,

That’s so much simpler than the various attempts that I made.

:-)

Best,
Trond


On 11 Nov 2013, at 19:41, Ignacio Huerta <[email protected]> wrote:

> Hi Trond,
> 
> Here's a simple way with the default routes. In front_controller.rb add
> this code:
> 
> def index
>  redirect_to Project.order("updated_at desc").first
> end
> 
> I always mess up asc/desc with date fields, but something very similar
> should work ;)
> 
> Regards,
> Ignacio
> 
> El 11/11/13 10:59, Trond Lossius escribió:
>> Hi,
>> 
>> I have a Hobo app with a Projects model, containing among others a
>> :updated_at field. Now I'd like to redirect the front page of the app to
>> the Show page for the most recently updated project. I've tried several
>> different approaches fiddling around with Routes.rb and
>> projects_controller.rb, but so far to no avail. I guess that I'll need
>> to make a route to something like /projects/latest, and redirect front
>> to this, but I don't manage to find a way of doing so.
>> 
>> Any suggestions for how to solve this would be highly appreciated!
>> 
>> Thanks,
>> Trond
>> 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Hobo Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/hobousers.
>> For more options, visit https://groups.google.com/groups/opt_out.
> 
> -- 
> Ignacio Huerta Arteche
> http://www.ihuerta.net
> Teléfono: 0034 645 70 77 35
> Email realizado con software libre
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Hobo Users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/hobousers/Xyqs-x9yT3Y/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to