joe
joe

Reputation: 1

ajax request internal server error

Everything is working good on local but when i try same codes in production, i get 500 (Internal Server Error) error. And also i need advices to refactor this code.

entries.controller

 def set_spam
    @entry = Entry.find(params[:entry_id])
    @entry.spam = params[:what] == "spam" ? true : false
    @entry.save         
    respond_to do |format|
            format.js 
     end        
 end

application.js

  $(".spams img").click(function () {
    $.post("/set-spam", { entry_id: $(this).attr("entry_id"), what: $(this).attr("class") } );
    return false;
  });

view

<div class="spams">
<img title="spam" class="spam" src="/images/pixel.gif" entry_id="<%= entry.id %>" />
</div>

route

post "/set-spam" => "entries#set_spam"

Upvotes: 0

Views: 382

Answers (1)

Arthur P
Arthur P

Reputation: 1060

Check out mongrel/bricks log. Can be anything starting from permissions on a file execution.

Upvotes: 2

Related Questions