I''m making a website for newspaper. While implemeting ARCHIVE function, I met a problem. I expect that "..../main/archive/volume_number" is redirected to "..../volume_number/index". However, there are so many volumes in archives and I can''t make all controllers manually, each for one volume. So, in "main" controller, in "archive" method, I want to dynamically create a controller named volume_number(probably specified by params[:id]) and redirect to the controller. Please help =) If you have another idea for implementing archives, please tell me. I''m using Mysql and articles are categorized by volume number. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Are these archives in separate databases? I don''t see you needing to create separate controllers for each archive. You might have to juggle some table naming features but nothing terribly insane. [I do it for a multi-site app I''m working on where each site has their own content db.] Without knowing more about the particular constraints you''re under I can''t/won''t hazard any further speculation but I wouldn''t give up just yet. RSL On 2/17/07, Yohan Jo <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > I''m making a website for newspaper. > While implemeting ARCHIVE function, I met a problem. > I expect that "..../main/archive/volume_number" is redirected to > "..../volume_number/index". > However, there are so many volumes in archives and I can''t make all > controllers manually, each for one volume. > So, in "main" controller, in "archive" method, I want to dynamically > create a controller named volume_number(probably specified by > params[:id]) and redirect to the controller. > Please help =) > > If you have another idea for implementing archives, please tell me. > I''m using Mysql and articles are categorized by volume number. > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you for your attention. Archives are not in separate databases. All articles are in one database(named ''entries''), and the database just has the attribute named ''volume''. The main page shows the lastest volume, that is newest. When someone clicks the ''archives'' button and choose the volume number, then screen changes and shows that volume in the same way as the lastest volume is shown.(I don''t mean that each volume has just one page. You can think one volume is one group of many pages.) Therefore, each volume must be distinguishable but must have the same structure on screen. Thanks. Russell Norris wrote:> Are these archives in separate databases? I don''t see you needing to > create > separate controllers for each archive. You might have to juggle some > table > naming features but nothing terribly insane. [I do it for a multi-site > app > I''m working on where each site has their own content db.] Without > knowing > more about the particular constraints you''re under I can''t/won''t hazard > any > further speculation but I wouldn''t give up just yet. > > RSL-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
As I see it you''re just wanting to index them by volume which is snaptastically easy. First you''ll need to make your routing aware of the the volume parameter. map.connect "/main/archive/:volume" will give you @volume [as a String, mind you] to use in your controller. In the controller just do something like Entry.find(:all, :conditions => ["volume = ?", @volume]). You might need to change that @volume to @volume.to_i but might not. This isn''t the whole solution [since 1) I don''t know the rest of your code and 2) you''re the one getting paid for it -- hopefully] but should get you moving in the right direction. RSL On 2/17/07, Yohan Jo <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Thank you for your attention. > > Archives are not in separate databases. > All articles are in one database(named ''entries''), and the database just > has the attribute named ''volume''. > The main page shows the lastest volume, that is newest. > When someone clicks the ''archives'' button and choose the volume number, > then screen changes and shows that volume in the same way as the lastest > volume is shown.(I don''t mean that each volume has just one page. You > can think one volume is one group of many pages.) > Therefore, each volume must be distinguishable but must have the same > structure on screen. > > Thanks. > > > Russell Norris wrote: > > Are these archives in separate databases? I don''t see you needing to > > create > > separate controllers for each archive. You might have to juggle some > > table > > naming features but nothing terribly insane. [I do it for a multi-site > > app > > I''m working on where each site has their own content db.] Without > > knowing > > more about the particular constraints you''re under I can''t/won''t hazard > > any > > further speculation but I wouldn''t give up just yet. > > > > RSL > > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you very much. It''s a very great solution for me. Thanks =) Russell Norris wrote:> As I see it you''re just wanting to index them by volume which is > snaptastically easy. First you''ll need to make your routing aware of the > the > volume parameter. map.connect "/main/archive/:volume" will give you > @volume > [as a String, mind you] to use in your controller. In the controller > just do > something like Entry.find(:all, :conditions => ["volume = ?", @volume]). > You > might need to change that @volume to @volume.to_i but might not. This > isn''t > the whole solution [since 1) I don''t know the rest of your code and 2) > you''re the one getting paid for it -- hopefully] but should get you > moving > in the right direction. > > RSL-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi~ On Feb 17, 2007, at 8:23 AM, Russell Norris wrote:> As I see it you''re just wanting to index them by volume which is > snaptastically easy. First you''ll need to make your routing aware > of the the volume parameter. map.connect "/main/archive/:volume" > will give you @volume [as a String, mind you] to use in your > controller. In the controller just do something like Entry.find > (:all, :conditions => ["volume = ?", @volume]). You might need to > change that @volume to @volume.to_i but might not. This isn''t the > whole solution [since 1) I don''t know the rest of your code and 2) > you''re the one getting paid for it -- hopefully] but should get you > moving in the right direction. > > RSL >Actually /main/archive/:volume will not give you @volume, it will give you params[:volume] -Ezra> On 2/17/07, Yohan Jo <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > Thank you for your attention. > > Archives are not in separate databases. > All articles are in one database(named ''entries''), and the database > just > has the attribute named ''volume''. > The main page shows the lastest volume, that is newest. > When someone clicks the ''archives'' button and choose the volume > number, > then screen changes and shows that volume in the same way as the > lastest > volume is shown.(I don''t mean that each volume has just one page. You > can think one volume is one group of many pages.) > Therefore, each volume must be distinguishable but must have the same > structure on screen. > > Thanks. > > > Russell Norris wrote: > > Are these archives in separate databases? I don''t see you needing to > > create > > separate controllers for each archive. You might have to juggle some > > table > > naming features but nothing terribly insane. [I do it for a multi- > site > > app > > I''m working on where each site has their own content db.] Without > > knowing > > more about the particular constraints you''re under I can''t/won''t > hazard > > any > > further speculation but I wouldn''t give up just yet. > > > > RSL > > > -- > Posted via http://www.ruby-forum.com/. > > > > > > >-- Ezra Zygmuntowicz -- Lead Rails Evangelist -- ez-NLltGlunAUd/unjJdyJNww@public.gmane.org -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
D''oh! You''re right! Now I''m scratching my head trying to figure out why I wrote [and _thought_] that when I do know better. Perhaps some brainfart about the long-deprecated @params variable? Sure, let''s blame that. [Shame on me.] RSL On 2/17/07, Ezra Zygmuntowicz <ezmobius-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hi~ > > On Feb 17, 2007, at 8:23 AM, Russell Norris wrote: > > > As I see it you''re just wanting to index them by volume which is > > snaptastically easy. First you''ll need to make your routing aware > > of the the volume parameter. map.connect "/main/archive/:volume" > > will give you @volume [as a String, mind you] to use in your > > controller. In the controller just do something like Entry.find > > (:all, :conditions => ["volume = ?", @volume]). You might need to > > change that @volume to @volume.to_i but might not. This isn''t the > > whole solution [since 1) I don''t know the rest of your code and 2) > > you''re the one getting paid for it -- hopefully] but should get you > > moving in the right direction. > > > > RSL > > > > > Actually /main/archive/:volume will not give you @volume, it will > give you params[:volume] > > -Ezra > > > > > > On 2/17/07, Yohan Jo <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > Thank you for your attention. > > > > Archives are not in separate databases. > > All articles are in one database(named ''entries''), and the database > > just > > has the attribute named ''volume''. > > The main page shows the lastest volume, that is newest. > > When someone clicks the ''archives'' button and choose the volume > > number, > > then screen changes and shows that volume in the same way as the > > lastest > > volume is shown.(I don''t mean that each volume has just one page. You > > can think one volume is one group of many pages.) > > Therefore, each volume must be distinguishable but must have the same > > structure on screen. > > > > Thanks. > > > > > > Russell Norris wrote: > > > Are these archives in separate databases? I don''t see you needing to > > > create > > > separate controllers for each archive. You might have to juggle some > > > table > > > naming features but nothing terribly insane. [I do it for a multi- > > site > > > app > > > I''m working on where each site has their own content db.] Without > > > knowing > > > more about the particular constraints you''re under I can''t/won''t > > hazard > > > any > > > further speculation but I wouldn''t give up just yet. > > > > > > RSL > > > > > > -- > > Posted via http://www.ruby-forum.com/. > > > > > > > > > > > > > > > -- Ezra Zygmuntowicz > -- Lead Rails Evangelist > -- ez-NLltGlunAUd/unjJdyJNww@public.gmane.org > -- Engine Yard, Serious Rails Hosting > -- (866) 518-YARD (9273) > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---