Rails Ajax Error 500
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta
500 Internal Server Error Rails Ajax
Discuss the workings and policies of this site About Us Learn more completed 500 internal server error rails about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack
Ruby Completed 500 Internal Server Error
Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping rails post 500 internal server error each other. Join them; it only takes a minute: Sign up Gettin 500 Internal Server Error in rails on ajax request up vote 3 down vote favorite I'm trying to create a record from a form. I've used railscast 136 as ground work. When I trying to submit I get a 500 error for missing partial. I've rails internal server error created the controller correlated javascript view but it is requesting a view with the same name as the model. error message Rendered appointments/create.js.erb (3.8ms) Completed 500 Internal Server Error in 12ms ActionView::Template::Error (Missing partial appointments/appointment with {:locale=>[:en], :formats=>[:js, :html], :handlers=>[:erb, :builder, :coffee]}. Searched in: * "/Users/gjores/Sites/Rails/verkstad_test/app/views" ): 1: $('#appointments').append('<%= j render(@appointment) %>'); app/views/appointments/create.js.erb:1:in _app_views_appointments_create_js_erb___2325925946390315228_70273089113920' app/controllers/appointments_controller.rb:16:increate' Controller def create @appointment = Appointment.new(params[:appointment]) if @appointment.save respond_to do |format| format.html { redirect_to new_appointment_path, :notice => "Successfully created appointment." } format.js end else render :action => 'new' end end appointments/new.html.erb
<%= s.name %> | <%= f.label :week %> | <%= f.number_field :week %> | <%= f.label :teacher_id %> | <%= f.collection_select(:teacher_id, Teacher.all, :id, :name) %> | <%= f.hidden_field :student_id, :value => s.id %><%= f.submit %> |
<%= link_to "Back to List", appointments_path %>
appointments/create.js.erb $('#appointments').append('<%= j render(@appointment) %>'); Routes appointments GET /appoinhere for a quick overview of the site Help Center Detailed answers to any questions you
500 Internal Server Error Ruby On Rails
might have Meta Discuss the workings and policies of this ajax 500 internal server error site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or
Rails Ajax Form
posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community http://stackoverflow.com/questions/14497843/gettin-500-internal-server-error-in-rails-on-ajax-request of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Rails Ajax 500 Server Error up vote 0 down vote favorite I am trying to get new comments to update with ajax instead of a page reload. I followed the railscast tutorial but am getting http://stackoverflow.com/questions/34937021/rails-ajax-500-server-error a 500 internal server error in my js console. I was reading other posts and a lot of people are saying its a partial error but I can't figure it out. The comment will save before page reload but will not display until the page is reloaded.. Here is the comment controller def create @post = Post.find(params[:post_id]) @comment = Comment.create(params[:comment].permit(:content)) @comment.user_id = current_user.id @comment.post_id = @post.id if @comment.save respond_to do |format| format.html {redirect_to post_path(@post.comments)} format.js end else render 'new' end end The create.js.erb file in the comment directory. $('.comment').append('<%= j render @post.comments %>'); The comment form <%= simple_form_for([@post, @post.comments.build], :remote => true, :input_html => { :data => { :url => '/post/:id', :type => :js } }) do |f| %> <%= f.input :content, label: "Reply"%> <%= f.button :submit, "Submit" %> <% end %> jquery ruby-on-rails ajax share|improve this question edited Jan 24 at 0:48 Dbz 1,41821542 asked Jan 22 at 0:35 nharvey27 32 What is the comment form named
here for a quick overview of the site Help Center Detailed answers to any questions http://stackoverflow.com/questions/19568667/why-does-my-rails-ajax-request-throw-internal-server-error you might have Meta Discuss the workings and policies of this http://stackoverflow.com/questions/10853640/ruby-on-rails-error-500-on-ajax-request site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a internal server community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Why does my rails AJAX request throw internal server error? up vote 0 down vote favorite I have a table , where each line has a link <%= link_to 'Delete', [lesson.group, lesson], remote: true,method: internal server error :delete%> I want the link to destroy the corresponding db entry and remove the corresponding line from the table without reloading the page. The action is def destroy @lesson = @group.lessons.find(params[:id]) @lesson.destroy respond_to do |format| if @lesson format.html { redirect_to edit_group_path(@group), notice:'Succesfully deleted lesson' } format.js {} else format.html { redirect_to edit_group_path(@group), notice:'Error!' } end end end The entries get removed, but I can only see the change when I reload the page, and the console throws DELETE http://localhost:3000/groups/1/lessons/14 500 (Internal Server Error) Extract from the log: Started DELETE "/groups/1/lessons/18" for 127.0.0.1 at 2013-10-24 18:39:22 +0400 Processing by LessonsController#destroy as JS Parameters: {"group_id"=>"1", "id"=>"18"} [1m[36mGroup Load (1.0ms)[0m [1mSELECT "groups".* FROM "groups" WHERE "groups"."id" = ? LIMIT 1[0m [["id", "1"]] [1m[35mLesson Load (1.0ms)[0m SELECT "lessons".* FROM "lessons" WHERE "lessons"."group_id" = 1 AND "lessons"."id" = ? LIMIT 1 [["id", "18"]] [1m[36m (0.0ms)[0m [1mbegin transaction[0m [1m[35mSQL (4.0ms)[0m DELETE FROM "lessons" WHERE "lessons"."id" = ? [["id", 18]] [1m[36m (10.0ms)[0m [1mcommit transaction[0m Complet
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Ruby on Rails error 500 on ajax request up vote 1 down vote favorite In application start up I wan to generate 10 persons with random data. When I do that I want to be able to filter them asynchronously by category. Here is the code: Model code: class Person attr_accessor :name, :text, :category, :timeStamp end Controller code: class PersonController < ApplicationController def index @persons = [] @categories = ["history", "science", "religion"] 10.times do person = Person.new person.name = [*('A'..'Z')].sample(8).join person.text = [*('A'..'Z')].sample(64).join person.category = @categories.sample person.timeStamp = Time.at(rand * Time.now.to_i) @persons.append(person) end end def loadPersonsByCategory @filteredPersons = @persons.where(:category => params[:category]) render :json => @filteredPersons end end View code: