D
Denis Nikiforov
(transmit-message (Hello *All*)
(Say '(
My apache' DocumentRoot looks like /my/home/folder/site/www/. Nitro is
placed in /my/home/folder/site/www/path/to/nitro/.
How must I configure Nitro?
I'd placed this dirty hack into my run.rb:
,----[ run.rb ]
| if ENV["REQUEST_URI"] =~ /^\/path\/to\/nitro\/public\//
| ENV["REQUEST_URI"]=ENV["REQUEST_URI"].sub('/path/to/nitro/public/', '/')
| BASE_URI = '/path/to/nitro/public'
| else
| BASE_URI = ''
| end
|
| class BaseURIMorpher < Morpher
| def before_start(buffer)
| if @attributes['href']
| if @attributes['href'] =~ /^\//
| @attributes['href'] = BASE_URI + @attributes['href']
| elsif @attributes['href'] =~ /^http:\/\//
| @attributes['href']
| else
| @attributes['href'] = BASE_URI + '/' + @attributes['href']
| end
| end
| if @attributes['action']
| if @attributes['action'] =~ /^\//
| @attributes['action'] = BASE_URI + @attributes['action']
| else
| @attributes['action'] = BASE_URI + '/' + @attributes['action']
| end
| end
| end
| end
|
| Morphing.add_morpher :href, BaseURIMorpher
| Morphing.add_morpher :action, BaseURIMorpher
`----
But it's too ugly and buggy ;( Actually, it doesn't work for forms
generated with form_for.
(Say '(
My apache' DocumentRoot looks like /my/home/folder/site/www/. Nitro is
placed in /my/home/folder/site/www/path/to/nitro/.
How must I configure Nitro?
I'd placed this dirty hack into my run.rb:
,----[ run.rb ]
| if ENV["REQUEST_URI"] =~ /^\/path\/to\/nitro\/public\//
| ENV["REQUEST_URI"]=ENV["REQUEST_URI"].sub('/path/to/nitro/public/', '/')
| BASE_URI = '/path/to/nitro/public'
| else
| BASE_URI = ''
| end
|
| class BaseURIMorpher < Morpher
| def before_start(buffer)
| if @attributes['href']
| if @attributes['href'] =~ /^\//
| @attributes['href'] = BASE_URI + @attributes['href']
| elsif @attributes['href'] =~ /^http:\/\//
| @attributes['href']
| else
| @attributes['href'] = BASE_URI + '/' + @attributes['href']
| end
| end
| if @attributes['action']
| if @attributes['action'] =~ /^\//
| @attributes['action'] = BASE_URI + @attributes['action']
| else
| @attributes['action'] = BASE_URI + '/' + @attributes['action']
| end
| end
| end
| end
|
| Morphing.add_morpher :href, BaseURIMorpher
| Morphing.add_morpher :action, BaseURIMorpher
`----
But it's too ugly and buggy ;( Actually, it doesn't work for forms
generated with form_for.