# Urgent! -- need suggestion

**URL:** <https://www.ruby-forum.com/t/urgent-need-suggestion/102805>\
**Category:** Rails\
**Created:** [July 15, 2006, 2:20am UTC](https://www.ruby-forum.com/t/urgent-need-suggestion/102805 "2006-07-15T02:20:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ragrawal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee59a6/32.png) [@ragrawal](https://www.ruby-forum.com/u/ragrawal)\
**Post date:** [July 15, 2006, 2:20am UTC](https://www.ruby-forum.com/t/urgent-need-suggestion/102805/1 "2006-07-15T02:20:37Z")

</div>

hi all,

I am starting to learn ruby and using ruby on rails. I have one  
question. I want to create a webpage that has two sections. The right  
section has all the tags (stored in a MySQL table) and in the section I  
display websites related to selected tag. I am not sure how to do this  
as I have two different actions to be fired in every webpage.

Any suggestion is most welcomed

Regards,  
Ritesh

---

<div class="post-metadata">

**Author:** ![ragrawal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee59a6/32.png) [@ragrawal](https://www.ruby-forum.com/u/ragrawal)\
**Post date:** [July 15, 2006, 2:37am UTC](https://www.ruby-forum.com/t/urgent-need-suggestion/102805/2 "2006-07-15T02:37:29Z")

</div>

Ritesh A. wrote:

> hi all,
> 
> I am starting to learn ruby and using ruby on rails. I have one  
> question. I want to create a webpage that has two sections. The right  
> section has all the tags (stored in a MySQL table) and in the section I  
> display websites related to selected tag. I am not sure how to do this  
> as I have two different actions to be fired in every webpage.
> 
> Any suggestion is most welcomed
> 
> Regards,  
> Ritesh

Why is it urgent?

jp

---

<div class="post-metadata">

**Author:** ![ragrawal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee59a6/32.png) [@ragrawal](https://www.ruby-forum.com/u/ragrawal)\
**Post date:** [July 15, 2006, 3:49am UTC](https://www.ruby-forum.com/t/urgent-need-suggestion/102805/3 "2006-07-15T03:49:19Z")

</div>

Hi,

I am working on a summer class project on web application development  
and need to give my first presentation next week. I was hoping a more  
favourable response. n’ways, I am still hoping some response to get me  
started

Regards,  
Ritesh

---

<div class="post-metadata">

**Author:** ![ragrawal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee59a6/32.png) [@ragrawal](https://www.ruby-forum.com/u/ragrawal)\
**Post date:** [July 15, 2006, 4:33am UTC](https://www.ruby-forum.com/t/urgent-need-suggestion/102805/4 "2006-07-15T04:33:31Z")

</div>

Ritesh A. wrote:

> hi all,
> 
> I am starting to learn ruby and using ruby on rails. I have one  
> question. I want to create a webpage that has two sections. The right  
> section has all the tags (stored in a MySQL table) and in the section I  
> display websites related to selected tag. I am not sure how to do this  
> as I have two different actions to be fired in every webpage.
> 
> Any suggestion is most welcomed
> 
> Regards,  
> Ritesh

Hi, Sounds like you want to setup a layout that will render the tags  
sidebar. Go lookup layouts, partials, and maybe even componenets. Hope  
your project goes well!

Chris C.  
[concentrationstudios.com](http://concentrationstudios.com)

---

<div class="post-metadata">

**Author:** ![ragrawal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee59a6/32.png) [@ragrawal](https://www.ruby-forum.com/u/ragrawal)\
**Post date:** [July 15, 2006, 4:47am UTC](https://www.ruby-forum.com/t/urgent-need-suggestion/102805/5 "2006-07-15T04:47:40Z")

</div>

On 7/14/06, Ritesh A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,
> 
> I am working on a summer class project on web application development  
> and need to give my first presentation next week.

It is probably a good idea to save “urgent” for when your client is  
freaking out on the phone that their website is currently down.

You just need a layout and a couple partials like Chris says. A good  
book is “Agile web development with rails.”

Peter

---

<div class="post-metadata">

**Author:** ![ragrawal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee59a6/32.png) [@ragrawal](https://www.ruby-forum.com/u/ragrawal)\
**Post date:** [July 15, 2006, 9:17am UTC](https://www.ruby-forum.com/t/urgent-need-suggestion/102805/6 "2006-07-15T09:17:11Z")

</div>

hi all,

thanks for your suggestions and in future I will take care about the  
word “Urgent”. I did buy “Agile web development with rails”. After  
quickly going through it what I understood is that for each controller  
action there is a view. But as the layout remains the same, it is  
possible to create static layout and store it in view/layout folder

What is I am not able to understand is how to call both the action. For  
eg consider a scenario that a tag list obtained from the database is  
loaded on the left pane. User selects the first tag. This will

1. call list action of the controller that handles webpages (say  
websites\_controller.rb)
2. list action will call the list view (which will be in  
view/websites/list.rhtml) and also the static template

Now here is my confusion. From where the action to list all the tags  
will be called. Probably my guess is that this will be somewhere in  
static template. At this point I am not sure what the partial view is  
but I will take a look. and thanks agains for all your help

Regards,  
Ritesh

---

<div class="post-metadata">

**Author:** ![ragrawal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee59a6/32.png) [@ragrawal](https://www.ruby-forum.com/u/ragrawal)\
**Post date:** [July 15, 2006, 9:26am UTC](https://www.ruby-forum.com/t/urgent-need-suggestion/102805/7 "2006-07-15T09:26:29Z")

</div>

On 7/15/06, Ritesh A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> websites\_controller.rb)  
> 2. list action will call the list view (which will be in  
> view/websites/list.rhtml) and also the static template
> 
> Now here is my confusion. From where the action to list all the tags  
> will be called. Probably my guess is that this will be somewhere in  
> static template. At this point I am not sure what the partial view is  
> but I will take a look. and thanks agains for all your help

In your Agile book, look up “Partial Page Templates” and “Helpers”.

---

<div class="post-metadata">

**Author:** ![ragrawal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee59a6/32.png) [@ragrawal](https://www.ruby-forum.com/u/ragrawal)\
**Post date:** [July 15, 2006, 10:04pm UTC](https://www.ruby-forum.com/t/urgent-need-suggestion/102805/8 "2006-07-15T22:04:50Z")

</div>

Hi Steve,

Thanks for informing about it. As suggested by James, I took a look at  
the partial view and helper section of the view. I have started to build  
my model and controller. Hopefully with all the information that I  
recieved I should be able to get it working before next week.

Thanks  
Ritesh

---

<div class="post-metadata">

**Author:** ![ragrawal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee59a6/32.png) [@ragrawal](https://www.ruby-forum.com/u/ragrawal)\
**Post date:** [July 15, 2006, 8:59pm UTC](https://www.ruby-forum.com/t/urgent-need-suggestion/102805/9 "2006-07-15T20:59:55Z")

</div>

I think you grasped the first bit of Rails, but if Rails were limited to  
one  
action =\> one view or “every controller has the same layout” it simply  
wouldn’t work for complex apps. Consider, in addition to partials,  
looking  
into:

render :layout =\> ‘foo’

You can explicitly tell Rails what layout to use or have it render  
without a  
layout. Additionally, if your whole controller uses a particular layout  
and  
it isn’t application.rhtml, just use the layout macro somewhere near the  
top  
of your controller:

class FooController \< ApplicationController  
layout :foo

def index  
.  
.  
.

As you can see, there is a lot of flexibility in how you use layouts.  
For  
more, see:

[http://api.rubyonrails.com/classes/ActionController/Layout/ClassMethods.html#M000103](http://api.rubyonrails.com/classes/ActionController/Layout/ClassMethods.html#M000103)

## Good luck.

View this message in context:  
[http://www.nabble.com/Urgent!----need-suggestion-tf1946010.html#a5342946](http://www.nabble.com/Urgent%21----need-suggestion-tf1946010.html#a5342946)  
Sent from the RubyOnRails Users forum at [Nabble.com](http://Nabble.com).
