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 -- Posted via http://www.ruby-forum.com/.
Ritesh Agrawal 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, > RiteshWhy is it urgent? jp -- Posted via http://www.ruby-forum.com/.
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 -- Posted via http://www.ruby-forum.com/.
Ritesh Agrawal 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, > RiteshHi, 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 Carter concentrationstudios.com -- Posted via http://www.ruby-forum.com/.
On 7/14/06, Ritesh Agrawal <ragrawal@gmail.com> 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
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 -- Posted via http://www.ruby-forum.com/.
On 7/15/06, Ritesh Agrawal <ragrawal@gmail.com> wrote:> 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 helpIn your Agile book, look up "Partial Page Templates" and "Helpers".
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 Good luck. -- View this message in context: http://www.nabble.com/Urgent%21----need-suggestion-tf1946010.html#a5342946 Sent from the RubyOnRails Users forum at Nabble.com.
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 -- Posted via http://www.ruby-forum.com/.