Justin Collins
3/18/2008 4:38:00 PM
Tony De wrote:
> Justin Collins wrote:
>
>> Tony De wrote:
>>
>>>> you can have any methods, classes, or other code that you want.
>>>> about the middle of the page here:
>>>>
>>> tonyd
>>>
>>>
>> It does matter where you place the method definition, in a way. That is,
>> you can only use it in the code following its definition.
>>
>> For example:
>>
>> def my_method
>> end
>>
>> my_method
>>
>> will work, but
>>
>> my_method
>>
>> def my_method
>> end
>>
>> will not.
>>
>> Are you getting a specific error message?
>> If your code is working with .cgi as it is, adding methods should not
>> change a thing.
>>
>> -Justin
>>
>
> Justin,
>
> I don't recall the exact error message now, it was late am yesterday.
> But that's exactly what I was doing. I was defining my method at the
> bottom of my code file, much as I would in a rails controller, sort of.
>
> So that I am clear on the file extension stuff. And for your info to
> properly respond to my question; our servers run FreeBSD, Apache2, and
> on this testing platform, mod_ruby. ? Do I need to use .cgi or .rb?
> Does it matter where the file is placed? Seemingly stupid questions,
> (and new to ruby) we know that a .cgi file is typically placed in the
> user_web_space cgi dir (or based on our tailored Apache config) to be
> executed. Would the same .rb file placed in the cgi dir be executed if
> called from the html? Would it need to be placed elsewhere? And/or are
> we talking about an Apache config mod? Was that clear as mud? Thanks
> greatly for your assistance. You've already been a great help.
>
> tonyd
>
>
Hi Tony,
It really depends on your setup. If you want to use mod_ruby, though,
you will need to modify Apache's config file, and there it will be
determined where your files will go and what extension you will use. If
you do not use mod_ruby, then your Ruby file can be run just like any
other cgi program from your cgi directory.
-Justin