Welcome Guest | Login

Globalite issue

Hi,
when trying to use
- form_tag @current_path, :method => @request_method do...
in my view i get the following error:
ActionView::TemplateError (undefined method `[]' for nil:NilClass)

Here is the whole error path: http://pastie.org/267200

Anyone has some tips to resolve that issue?

Thanks!

2008-09-06 09:01 AM

Hi Jockel,

Have you tried using form_tag as shown below? If not, can you give a try.

form_tag (@current_path, {:method => @request_method}) do

2008-09-06 10:21 AM

Hi Vinayan,

I tried your suggestion but still same error.

Any other ideas?

2008-09-06 03:54 PM

Hi Jockel,

Can you confirm that both @current_path and @request_method are not nil when the form_tag method is being called? I suspect this may be your issue.

2008-09-06 09:43 PM

Hi Kotrin,

my localized_application module (in the "lib" directory) defines the "set_locale" method which sets both @current_path and @request_method and is executed as a before_filter in application.rb (controller).
Thus, they shouldn't be nil and in my development environment on my local machine it works well.

Do I have to change this processing logic anyhow to make it work in production on your servers?


2008-09-16 05:55 AM

Jawosis,

You shouldn't have to. And, I know they _shouldn't_ be nil but that doesn't mean they aren't. Can you run logic test before the form_tag method to catch nil's just to be sure?

2008-09-16 08:14 AM

Ok, before the form_tag there is no nil, but the @current_path and @request instance variables are set as follows:
@current_path = request.env['PATH_INFO']
@request_method = request.env['REQUEST_METHOD']

Might that be the cause and if so how to change this?

2008-09-16 09:08 AM

Hmm...isn't 'request' suppose to be an instance variable? aka @request.env['PATH_INFO'] and @request.env['REQUEST_METHOD'] ? None the less, if the variables are being set to the path and method you want, they should be working. What are your logs saying?

2008-09-16 09:30 AM

Still the same error in the log - unfortunately!

FYI - I followed this example to let the user set the app locale: http://code.google.com/p/globalite/wiki/SetLocaleUsingAnAroundFilter

2008-09-16 11:10 AM

OK, replacing "request.env['PATH_INFO']" and "request.env['REQUEST_METHOD']" with "request.request_uri" resp. ":get" solved that issue - at least!!

But, I right stepped into the next problem :-(

All images referred to with "/images/..." are not displayed in the app although they are stored in the right folder "public_html/neueslicht2/images".

Images in another public folder than "images" are displayed in the app.

Do I have to use another path declaration to reference right?

2008-09-16 03:27 PM

Jawosis, I'm afraid I'm not quite following you here.  When you say:

"All images referred to with "/images/..." are not displayed in the app "

can you give an example of a path that doesn't access an image correctly?

Any static file in your public folder should be able to be accessed unless you are running fastcgi and have .htaccess rules in place to prevent this.

2008-09-16 07:09 PM

Considering the naming of your tutorial for multiple apps I have a main app ("app1") and a second app ("app2") as a subfolder of the main app.

This path doesn't display the image: "/app2folder/images/image.jpg"

But this works: "/app2folder/otherimagefoldername/image.jpg"

I followed the .htaccess rules of your tutorial to set up this second app.

It seems to be a naming conflict of images.

What would you recommend - I hope not changing all the code to look for images in another folder than "images"?

2008-09-17 03:55 AM

I've put the following rewrite rule in your .htaccess file and the issue seems to be fixed now.
-----------
RewriteCond %{REQUEST_URI} ^/images.* [OR]
RewriteCond %{REQUEST_URI} ^/stylesheets.* [OR]
RewriteCond %{REQUEST_URI} ^/javascripts.* [OR]
RewriteCond %{REQUEST_URI} ^/<otherimagefoldername>.*
RewriteRule .* - [L]

Please verify and let us know if you need any further help.

2008-09-17 10:41 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.