# Issues With New Site

**URL:** <https://www.ruby-forum.com/t/issues-with-new-site/156048>\
**Category:** Rails\
**Created:** [December 19, 2008, 7:06pm UTC](https://www.ruby-forum.com/t/issues-with-new-site/156048 "2008-12-19T19:06:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpierry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@rpierry](https://www.ruby-forum.com/u/rpierry)\
**Post date:** [December 19, 2008, 7:06pm UTC](https://www.ruby-forum.com/t/issues-with-new-site/156048/1 "2008-12-19T19:06:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rpierry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@rpierry](https://www.ruby-forum.com/u/rpierry)\
**Post date:** [December 19, 2008, 7:14pm UTC](https://www.ruby-forum.com/t/issues-with-new-site/156048/2 "2008-12-19T19:14:10Z")

</div>

take a look at [learningrails.com](http://learningrails.com)  
they have some excellent videos on creating an app with the login  
functionality

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

> **[Ruby on Rails Screencasts - RailsCasts](http://railscasts.com)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

jason

On Fri, Dec 19, 2008 at 12:06 PM, Rob Pa

---

<div class="post-metadata">

**Author:** ![rpierry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@rpierry](https://www.ruby-forum.com/u/rpierry)\
**Post date:** [December 20, 2008, 6:36am UTC](https://www.ruby-forum.com/t/issues-with-new-site/156048/3 "2008-12-20T06:36:16Z")

</div>

On Dec 19, 1:06 pm, Rob Pa [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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  
removed\_email\_address@domain.invalid  
[http://www.marnen.org](http://www.marnen.org)

---

<div class="post-metadata">

**Author:** ![rpierry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@rpierry](https://www.ruby-forum.com/u/rpierry)\
**Post date:** [December 20, 2008, 8:24am UTC](https://www.ruby-forum.com/t/issues-with-new-site/156048/4 "2008-12-20T08:24:27Z")

</div>

Hi Rob,

Partials sounds the go to me !

cheers Dave
