If I have a module that looks like this: module Mymod require ''cgi'' params=CGI.new end and I call a particular webpage like this: http://www.mydomain.com/test1.html?test=value and the particular web page has code in it that looks like this: <% require mymod %> <p><%= Mymod::params[''test''] %></p> why does this bomb instead of displaying the word ''test''? If I move the contents of the module to the actual page, I can get it to work just fine (of course, under that condition I omit the ''Mymod::''). How can I make this work? Thanks for any input. ... doug --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Dec 28, 7:41 pm, doug <ddjol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If I have a module that looks like this: > > module Mymod > require ''cgi'' > params=CGI.new > end >This doesn''t make a params mehod on mymodule. It just creates a local variable. Not sure why you''re fiddling around with CGI though. Fred> and I call a particular webpage like this: > > http://www.mydomain.com/test1.html?test=value > > and the particular web page has code in it that looks like this: > > <% require mymod %> > <p><%= Mymod::params[''test''] %></p> > > why does this bomb instead of displaying the word ''test''? > > If I move the contents of the module to the actual page, I can get it > to work just fine (of course, under that condition I omit the > ''Mymod::''). > > How can I make this work? > > Thanks for any input. > > ... doug--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> This doesn''t make a params mehod on mymodule. It just creates a local > variable.Thanks.> Not sure why you''re fiddling around with CGI though.It''s a bit of a because-it''s-there type thing. I''m just playing around with some more basic Ruby code to see what I can and can''t do. I''m still at a loss as to how I would pass the params from the module to the code that is requiring it. Thanks again for the input. ... doug --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---