On Wednesday, March 5, 2014 4:28:54 PM UTC-5, Ruby-Forum.com User wrote:
>
> Hello, 
> I've been stuck on an issue for a few days now and I haven't been able 
> to find any help online (asked multiple questions on stackoverflow). I'm 
> not sure what to do anymore. 
>
> Basically, I have a model 'competition' that allows users to attend it. 
> The user can click 'attend' or 'withdraw' and change their status. it 
> used to work, but my javascript was messed up and I'm not sure how to 
> fix it. If anyone could take a look at the question and hopefully help 
> me out that would be appreciated. 
>
>
> http://stackoverflow.com/questions/22161132/rails-jquery-sending-get-instead-of-post-request
>  
>
> Thanks 
>
> -- 
> Posted via http://www.ruby-forum.com/. 
>

The message you're getting about event.returnValue is a warning, it 
shouldn't be causing your problem.  This is basic, but you didn't show your 
gemfile, I'm assuming you have the gem 'jquery-rails' listed.  Also, it 
should be a relatively current version as the older versions had an issue 
with this.  Finally, if there are any jquery files in your 
assets/javascripts folder, you should delete them.  I'm covering these 
bases only because it sounds like you had an older app that was working and 
were forced to update it.

Other than that, I would follow Hassan's recommendation and rebuild.   
Links are not really intended to be used to pass a post, so Rails has 
basically rigged it by using javascript to generate a form and submit it. 
 IMO, it's not a great architecture.  If javascript is disabled or there 
are errors, it defaults to sending it as a get.  You may want to consider 
using button_to instead of link_to, or you could also change your route to 
"match 'withdraw', via: [:get, :post]" to catch both actions.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/23f84635-1ff6-4382-ae75-80acdd8286ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to