Help Please!

Hi everyone, I asking for some help here If you could take a look of
this code, I can’t find the problem 'cause it’s not working I’m using
Netbeans 6.7, and I copied it from a example:

Product Type
<%= select 'product', 'product_type_id',@product_types.collect {|p| [ p.name, p.id ] },{},:onChange => "\$(waitOut).innerHTML= '(Updating categories, please wait...)';new Ajax.Updater('categoriesSelector','#{url_for(:controller=>'products', :action=>'categories_partial',:id=>@product)}?tp=' + this[this.selectedIndex].value, {onComplete:function(){\$(waitOut).innerHTML='';new Effect.Highlight('categoriesSelector');},asynchronous:true});"%>

Thanks!

That looks like javascript using the prototype.js library. That doesn’t
relate to jruby. Maybe you’d like to take your question to the
prototype.js
list:
http://groups.google.com/group/prototype-core

-Justin

Really though you need to describe what the problem is. Such as an error
message, or where it’s going wrong, or what’s occuring. I do recommend
with
the previous, and post on prototype forum or ask on a mailing list.

Aaron McLeod wrote:

Really though you need to describe what the problem is. Such as an error
message, or where it’s going wrong, or what’s occuring. I do recommend
with
the previous, and post on prototype forum or ask on a mailing list.


The error that shows in the IE:

ActionController::InvalidAuthenticityToken in
ProductsController#categories_partial
ActionController::InvalidAuthenticityToken
RAILS_ROOT: (path)Documents/NetBeansProjects/shoplet

This is a problem with Ruby On Rails, also not a JRuby problem.

You are getting caught by the Rails request forgery protection. That
often
happens when you do an Ajax request without submitting the authenticity
token along with the request.

You can likely just add this line to your ProductsController class:

protect_from_forgery :only => [:create, :update, :destroy]

This will turn off the protection except in cases where you’re calling
the
create, update or destroy methods.

-Justin

Justin C. wrote:

This is a problem with Ruby On Rails, also not a JRuby problem.

You are getting caught by the Rails request forgery protection. That
often
happens when you do an Ajax request without submitting the authenticity
token along with the request.

You can likely just add this line to your ProductsController class:

protect_from_forgery :only => [:create, :update, :destroy]

This will turn off the protection except in cases where you’re calling
the
create, update or destroy methods.

-Justin


Thanks Men!

It works perfect! You rock!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs