Forum: Ruby on Rails Issues With New Site

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C00218c047a27287fd91a3251976c425?d=identicon&s=25 Rob P. (robmfc)
on 2008-12-19 19:06
Hi,

I am using Ruby on Rails to create a new site.

On every page, I want to have a log in box. I also want to display the
latest 5 news items on all the pages as well.

How could I go around this? Is it possible to have @news =
News.find(:all, :limit => 5 ) in the application handler, and then call
the @news on all pages?

Would I also be able to handle the log in code in the main application
controller aswell?

Thanks a lot,
Rob
82e31cc9f57fcbd5c797ac4f8e3a7551?d=identicon&s=25 Jason White (silliemunkie)
on 2008-12-19 19:14
(Received via mailing list)
take a look at learningrails.com
they have some excellent videos on creating an app with the login
functionality

Ryan Bates also has great screencasts on almost every topic to get you
up
and running

railscasts.com

jason

On Fri, Dec 19, 2008 at 12:06 PM, Rob Pa
Dd2d775dea75b381edb1bbf0600a0907?d=identicon&s=25 Marnen Laibow-Koser (marnen)
on 2008-12-20 06:36
(Received via mailing list)
On Dec 19, 1:06 pm, Rob Pa <rails-mailing-l...@andreas-s.net> wrote:
> Hi,
>
> I am using Ruby on Rails to create a new site.
>
> On every page, I want to have a log in box. I also want to display the
> latest 5 news items on all the pages as well.
>
> How could I go around this?

You would probably want to put these elements in your layout, rather
than in each individual view.

> Is it possible to have @news =
> News.find(:all, :limit => 5 ) in the application handler, and then call
> the @news on all pages?

You could do this, but it would probably be easier and more
maintainable to use a partial.

>
> Would I also be able to handle the log in code in the main application
> controller aswell?

Yes.  See restful_authentication for a very nice login plugin (I use
it on most of my apps).

>
> Thanks a lot,
> Rob

Best,
--
Marnen Laibow-Koser
marnen@marnen.org
http://www.marnen.org
4b0889adddec0b9bae5435e0c233b1e3?d=identicon&s=25 Davo (Guest)
on 2008-12-20 08:24
(Received via mailing list)
Hi Rob,

Partials sounds the go to me !

cheers Dave
This topic is locked and can not be replied to.