Firefox won't let me send '&' with AJAX!

Hi Nina,

nina wrote:

But I've also got another problem with parenthesis/brackets like "folder(2006)". I'm programming an online file_browser and I can't enter directories by link_to_remote which have a name with brackets or even contain a file which is named with brackets. I always get an error message that says, that one ")" is missing.

If you post some code that's causing you problems, maybe we can help. As far as the problem above, link_to_remote invokes a controller method. At first blush, it doesn't sound like you're using it correctly, but code and an explanation of what you're trying to accomplish will probably help.

Best regards, Bill

I use the following snippet in a before_filter to clean up params
affected by this encoding 'feature':

URI: /admin/en/products_extras?extra_id=1&product_id

Filter snippet:

   def clean_params_proxy(*to_clean)      to_clean.map{|p| params[p] = params["amp;#{p.to_s}"] if
params.has_key?("amp;#{p.to_s}")}    end

  Usage:

class Admin::ProductExtrasController < Admin::BaseController

   before_filter :clean_params, :only => :create

  def create; end

  def destroy; end

protected

def clean_params     clean_params_proxy :product_id, :extra_id end

end

- Lourens

Lourens Naude ha scritto:


I use the following snippet in a before_filter to clean up params affected by this encoding 'feature':
URI: /admin/en/products_extras?extra_id=1&product_id
Filter snippet:
def clean_params_proxy(*to_clean)
to_clean.map{|p| params[p] = params["amp;#{p.to_s}"] if params.has_key?("amp;#{p.to_s}")}
end
Usage:
class Admin::ProductExtrasController < Admin::BaseController
before_filter :clean_params, :only => :create
def create; end
def destroy; end
protected
def clean_params
clean_params_proxy :product_id, :extra_id
end
end
- Lourens

Hi Nina,
nina wrote:
But I've also got another problem with parenthesis/brackets
like "folder(2006)". I'm programming an online file_browser
and I can't enter directories by link_to_remote which have a
name with brackets or even contain a file which is named with
brackets. I always get an error message that says, that one ")"
is missing.

If you post some code that's causing you problems, maybe we can help. As
far as the problem above, link_to_remote invokes a controller method. At
first blush, it doesn't sound like you're using it correctly, but code and
an explanation of what you're trying to accomplish will probably help.
Best regards,
Bill

I don’t understand what is the problem but I see a formal error amp; instead of &

Correct this

     def clean_params_proxy(*to_clean)
to_clean.map{|p| params[p] = params["amp;#{p.to_s}"] if params.has_key?("amp;#{p.to_s}")}
end

into

     def clean_params_proxy(*to_clean)
to_clean.map{|p| params[p] = params["&amp;#{p.to_s}"] if params.has_key?("&amp;#{p.to_s}")}
end

Hope this help and have fun !