Folks, I am linking from page A to page B, and back again. When I go from A -> B, the B_controller.rb runs fine, and the page renders properly. But, when I go from B -> A, the A_controller.rb doesn''t run again, so the array (@A) is nil (which causes a problem). Should the controller run each time the page is accessed? Any ideas? Marcus Marcus Blankenship Technology Services - Software Group JELD-WEN, inc. Information Systems 541-882-3451 x 2558 marcusb@jeld-wen.com RELIABILITY for real life* This correspondence is for the named person''s use only. It may contain confidential or legally privileged information and is intended solely for the named addressee. If you receive this correspondence in error, please notify the sender and delete it from your system. You must not disclose, copy or rely on any part of this correspondence if you are not the intended recipient. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060518/d0bfd716/attachment.html
On 5/18/06, Marcus Blankenship <MarcusB@jeld-wen.com> wrote:> Folks, > I am linking from page A to page B, and back again. When I go from A -> B, > the B_controller.rb runs fine, and the page renders properly. But, when I go > from B -> A, the A_controller.rb doesn''t run again, so the array (@A) is nil > (which causes a problem). > > Should the controller run each time the page is accessed? Any ideas?If you send through some code samples someone might be able to help. cheers, Ben
Will do, thanks! -------------------------- Sent from my BlackBerry Wireless Handheld -----Original Message----- From: rails-bounces@lists.rubyonrails.org To: rails@lists.rubyonrails.org Sent: Wed May 17 18:18:55 2006 Subject: Re: [Rails] NOOB: Second post, please help... On 5/18/06, Marcus Blankenship <MarcusB@jeld-wen.com> wrote:> Folks, > I am linking from page A to page B, and back again. When I go from A -> B, > the B_controller.rb runs fine, and the page renders properly. But, when I go > from B -> A, the A_controller.rb doesn''t run again, so the array (@A) is nil > (which causes a problem). > > Should the controller run each time the page is accessed? Any ideas?If you send through some code samples someone might be able to help. cheers, Ben _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060518/eab171cf/attachment.html
Here is my code example: Fyi - in this example "facility" is the parent table to the "permits" table. Page A (facility) links to page B (permits) using this code, and it works fine. <%= link_to ''Permits'', { :action => ''..\permits\list'', :facilityid => facility}, :post => true %> Page B (permits) then links back to page A(facility), but this does not work. <%= link_to ''Return to facilities'', :action => ''../facilities/list'', :post => true %> The error I get when going from page B -> A, is that code in the facility/list.rhtml -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Ben and Kaz Askins Sent: Wednesday, May 17, 2006 6:19 PM To: rails@lists.rubyonrails.org Subject: Re: [Rails] NOOB: Second post, please help... On 5/18/06, Marcus Blankenship <MarcusB@jeld-wen.com> wrote:> Folks, > I am linking from page A to page B, and back again. When I go from A > -> B, the B_controller.rb runs fine, and the page renders properly. > But, when I go from B -> A, the A_controller.rb doesn''t run again, so > the array (@A) is nil (which causes a problem). > > Should the controller run each time the page is accessed? Any ideas?If you send through some code samples someone might be able to help. cheers, Ben _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails
Here is my code example: Fyi - in this example "facility" is the parent table to the "permits" table. Page A (facility) links to page B (permits) using this code, and it works fine. <%= link_to ''Permits'', { :action => ''..\permits\list'', :facilityid => facility}, :post => true %> Page B (permits) then links back to page A(facility), but this does not work. <%= link_to ''Return to facilities'', :action => ''../facilities/list'', :post => true %> The error I get when going from page B -> A, is in this code in the facility/list.rhtml: <% for facility in @facilities %> The message is that @facilities is nil. "@facilities" gets initialized by the controller''s ''list'' property. Any thoughts? Should the controller run each time the page is accessed? Is there a better way to accomplish what I am trying to do? Thanks, Marcus -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Ben and Kaz Askins Sent: Wednesday, May 17, 2006 6:19 PM To: rails@lists.rubyonrails.org Subject: Re: [Rails] NOOB: Second post, please help... On 5/18/06, Marcus Blankenship <MarcusB@jeld-wen.com> wrote:> Folks, > I am linking from page A to page B, and back again. When I go from A > -> B, the B_controller.rb runs fine, and the page renders properly. > But, when I go from B -> A, the A_controller.rb doesn''t run again, so > the array (@A) is nil (which causes a problem). > > Should the controller run each time the page is accessed? Any ideas?If you send through some code samples someone might be able to help. cheers, Ben _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails
Marcus, When I try your facilities link_to I get a link like: http://localhost:3000/facilities/../facilities/list?post=true Which does result in @facilities being nil for me. You might try rewriting the link as <%= link_to ''Return to facilities'', { :controller => ''facilities'', :action => ''list'' }, :post => true %> The bit that makes the link url itself in the middle should be enclosed in {} so that rails knows where the hash begins and ends. :post is an option, not part of the link hash. HTH Jeff On 5/18/06, Marcus Blankenship <MarcusB@jeld-wen.com> wrote:> > Here is my code example: > Fyi - in this example "facility" is the parent table to the "permits" > table. > > Page A (facility) links to page B (permits) using this code, and it > works fine. > <%= link_to ''Permits'', { :action => ''..\permits\list'', :facilityid => > facility}, :post => true %> > > > Page B (permits) then links back to page A(facility), but this does not > work. > <%= link_to ''Return to facilities'', :action => ''../facilities/list'', > :post => true %> > > The error I get when going from page B -> A, is in this code in the > facility/list.rhtml: > > <% for facility in @facilities %> > > The message is that @facilities is nil. "@facilities" gets initialized > by the controller''s ''list'' property. > > Any thoughts? Should the controller run each time the page is accessed? > Is there a better way to accomplish what I am trying to do? > > Thanks, > Marcus > > > -----Original Message----- > From: rails-bounces@lists.rubyonrails.org > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Ben and Kaz > Askins > Sent: Wednesday, May 17, 2006 6:19 PM > To: rails@lists.rubyonrails.org > Subject: Re: [Rails] NOOB: Second post, please help... > > On 5/18/06, Marcus Blankenship <MarcusB@jeld-wen.com> wrote: > > Folks, > > I am linking from page A to page B, and back again. When I go from A > > -> B, the B_controller.rb runs fine, and the page renders properly. > > But, when I go from B -> A, the A_controller.rb doesn''t run again, so > > the array (@A) is nil (which causes a problem). > > > > Should the controller run each time the page is accessed? Any ideas? > > If you send through some code samples someone might be able to help. > > cheers, > Ben > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060518/216bee34/attachment.html
Thanks! This works much better. I didn''t realize link_to had a :controller property. ________________________________ From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Jeff Everett Sent: Thursday, May 18, 2006 8:21 AM To: rails@lists.rubyonrails.org Subject: Re: [Rails] NOOB: Second post, please help... Marcus, When I try your facilities link_to I get a link like: http://localhost:3000/facilities/../facilities/list?post=true Which does result in @facilities being nil for me. You might try rewriting the link as <%= link_to ''Return to facilities'', { :controller => ''facilities'', :action => ''list'' }, :post => true %> The bit that makes the link url itself in the middle should be enclosed in {} so that rails knows where the hash begins and ends. :post is an option, not part of the link hash. HTH Jeff On 5/18/06, Marcus Blankenship <MarcusB@jeld-wen.com> wrote: Here is my code example: Fyi - in this example "facility" is the parent table to the "permits" table. Page A (facility) links to page B (permits) using this code, and it works fine. <%= link_to ''Permits'', { :action => ''..\permits\list'', :facilityid => facility}, :post => true %> Page B (permits) then links back to page A(facility), but this does not work. <%= link_to ''Return to facilities'', :action => ''../facilities/list'', :post => true %> The error I get when going from page B -> A, is in this code in the facility/list.rhtml: <% for facility in @facilities %> The message is that @facilities is nil. "@facilities" gets initialized by the controller''s ''list'' property. Any thoughts? Should the controller run each time the page is accessed? Is there a better way to accomplish what I am trying to do? Thanks, Marcus -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Ben and Kaz Askins Sent: Wednesday, May 17, 2006 6:19 PM To: rails@lists.rubyonrails.org Subject: Re: [Rails] NOOB: Second post, please help... On 5/18/06, Marcus Blankenship < MarcusB@jeld-wen.com> wrote: > Folks, > I am linking from page A to page B, and back again. When I go from A > -> B, the B_controller.rb runs fine, and the page renders properly. > But, when I go from B -> A, the A_controller.rb doesn''t run again, so > the array (@A) is nil (which causes a problem). > > Should the controller run each time the page is accessed? Any ideas? If you send through some code samples someone might be able to help. cheers, Ben _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060518/58c98376/attachment.html