Completed 500 Internal Server Error Ruby On Rails
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings 500 internal server error rails ajax and policies of this site About Us Learn more about Stack Overflow completed 500 internal server error heroku the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags rails post 500 (internal server error) Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only
Rails Internal Server Error
takes a minute: Sign up Completed 500 Internal Server Error in Ruby on Rails up vote -2 down vote favorite I'm trying to do a search but did not get any result. This is wrong: def BuscarRoles(usuario) @sql="SELECT * FROM rols WHERE id_rol IN (SELECT id_rol FROM rol_usuarios WHERE id_usuario = "+usuario.to_s+")" @roles = ActiveRecord::Base.connection.execute(@sql) @tira='[' if @roles.count>0 @aroles.each do |rol| @tira = @tira+" { id_rol: '" + rol.id_rol.to_s + "', descripcion: '" + rol.descripcion.to_s j=j+1 if j<@roles.count @tira = @tira+ " }, " else @tira = @tira+" } ] " end end else @tira= @tira+"{ { text: 'No hay datos', id: '0', href: '', leaf: true } } ]" end return @tira end mysql ruby-on-rails ruby activerecord mysql2 share|improve this question edited Dec 26 '14 at 13:31 user3522371 asked Dec 26 '14 at 13:30 Carlos Mora 812 No body can understand this :( Post the trace. BTW did you check the trace and try finding out which line caused the issue ? –Pamio Solanky Dec 26 '14 at 13:38 the line wich caused the issue " @aroles.each do |rol|" it's like the obj was nil. but there are rows in the databae –Carlos Mora Dec 26 '14 at 13:45 This code is downright dangerous. A primitive query is run with raw SQL without any escaping, the result is rendered into JSON by hand. Method name is CamelCased and is confused with a
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 4.7 http://stackoverflow.com/questions/27657840/completed-500-internal-server-error-in-ruby-on-rails million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Internal server error with ruby on rails up vote 0 down vote favorite Trying to make this ajax call work.But I get the 500 Internal server error. Updated: Script.js $.ajax({ type: "GET", url: '/books/103/last_chapter.json', success: function(data) { http://stackoverflow.com/questions/36573136/internal-server-error-with-ruby-on-rails $("body").append(data); }, error: function(xhr, status, response) {console.log('response ' + response + ' , xhr' + xhr + ' , ' + 'STATUS ' + status)} }); Chapter controller: def last_chapter Chapter.order(created_at: :desc).limit(1) respond_to do |format| format.js end end config.routes resources :books do member do get '/last_chapter/', to: 'chapters#last_chapter', as: 'last_chapter' end resources :chapters end How the route looks in the terminal: last_chapter_book GET /books/:id/last_chapter(.:format)chapters#last_chapter The error in terminal Started GET "/books/103/last_chapter" for 127.0.0.1 at 2016-04-12 14:17:37 +0200 Processing by ChaptersController#last_chapter as */* Parameters: {"id"=>"103"} Completed 500 Internal Server Error in 4ms (ActiveRecord: 0.0ms) ActionView::MissingTemplate (Missing template chapters/last_chapter, application/last_chapter with {:locale=>[:en], :formats=>[:js, :html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in: * "/Users/namek/myrails/app/views" ): app/controllers/chapters_controller.rb:28:in `last_chapter' last_chapter.json json.extract! @last_chapter, :id, :title, :characters, :created_at, :updated_at ruby-on-rails ruby ajax share|improve this question edited Apr 12 at 13:14 asked Apr 12 at 12:21 Cinta 327 add a comment| 3 Answers 3 active oldest votes up vote 0 down vote Try this get '/last_chapter/', to: 'ch
the internal website business development https://community.spiceworks.com/topic/530134-cannot-render-html-erb-completed-500-internal-server-error Technology The main challenge of the Project is continuous improving of the business company. Simplified Reporting We wanted more responsive insight into https://bugzilla.redhat.com/show_bug.cgi?id=911628 our sales organization. What we developed became affectionally known as the Red/Green report by our management team IN THIS DISCUSSION Ruby internal server MySQL PostgreSQL Join the Community! Creating your account only takes a few minutes. Join Now I have begun converting a Postgres database to mysql and suddenly cannot render my other webpages. I am trying to get http://reinhartsample.com/coffee and other pages to render. They internal server error were working before I changed my gem file and ran bundle install to convert to mysql.The index page comes up just fine but everything else gets a message We're sorry, but something went wrong. When I look at the log file I can see the following errors. TextActiveRecord::StatementInvalid (Mysql2::Error: No database selected: SHOW FULL FIELDS FROM `tea_orders`): app/controllers/home_controller.rb:17:in `new' app/controllers/home_controller.rb:17:in `tea' Started GET "/crunchytoppings" for xx.xx.xx.xx at 2014-06-30 11:42:00 -0500 Processing by HomeController#crunchytoppings as HTML Completed 500 Internal Server Error in 2ms ActiveRecord::StatementInvalid (Mysql2::Error: No database selected: SHOW FULL FIELDS FROM `ct_orders`): app/controllers/home_controller.rb:10:in `new' app/controllers/home_controller.rb:10:in `crunchytoppings' Started GET "/coffee" for xx.xx.xx.xx at 2014-06-30 11:42:02 -0500 Processing by HomeController#index as HTML Completed 500 Internal Server Error in 2ms ActiveRecord::StatementInvalid (Mysql2::Error: No database selected: SHOW FULL FIELDS FROM `orders`): app/controllers/home_controller.rb:3:in `new' app/controllers/home_controlle
Printing -XML -Clone This Bug -Last Comment First Last Prev Next This bug is not in your last search results. Bug911628 - Completed 500 Internal Server Error in 4235ms Summary: Completed 500 Internal Server Error in 4235ms Status: NEW Aliases: None Product: CloudForms Cloud Engine Classification: Red Hat Component: aeolus-conductor (Show other bugs) Sub Component: --- Version: 1.1.0 Hardware: Unspecified Unspecified Priority high Severity low TargetMilestone: rc TargetRelease: --- Assigned To: Angus Thomas QA Contact: Rehana Docs Contact: URL: Whiteboard: Keywords: Depends On: Blocks: Show dependency tree /graph Reported: 2013-02-15 08:58 EST by James Laska Modified: 2015-01-07 19:18 EST (History) CC List: 1 user (show) srevivo See Also: Fixed In Version: Doc Type: Bug Fix Doc Text: Story Points: --- Clone Of: Environment: Last Closed: Type: Bug Regression: --- Mount Type: --- Documentation: --- CRM: Verified Versions: Category: --- oVirt Team: --- RHEL 7.3 requirements from Atomic Host: Cloudforms Team: --- Attachments (Terms of Use) aeolus-debug.tar.gz (5.20 MB, application/octet-stream) 2013-02-15 08:58 EST, James Laska no flags Details Screenshots and automation log.zip (7.57 MB, application/octet-stream) 2013-02-15 09:00 EST, James Laska no flags Details Add an attachment (proposed patch, testcase, etc.) Groups: None (edit) Description James Laska 2013-02-15 08:58:42 EST Created attachment 697806 [details] aeolus-debug.tar.gz Description of problem: While running automation, conductor occasionally fails and reports a error 500. The URL, and steps to reproduce are rarely the same (at least, no pattern has been detected). Repeating the operation that resulted in a 500, always succeeds without error. Version-Release number of selected component (if applicable): * aeolus-conductor-0.13.26-1.el6cf.src.rpm * aeolus-configure-2.8.11-1.el6cf.src.rpm * imagefactory-1.0.2_3_gadcc5de-1.el6cf.src.rpm * oz-0.8.0-8.el6cf.src.rpm How reproducible: I hit this at least once, during a install/configure/automate flow Steps to Reproduce: 1. Install conductor on a fresh system 2. Configure conductor for supported providers 3. Run automation workflow that involves creating users, groups, clouds, zones, provider accounts etc... Actual results: [ /var/log/aeolus-conductor/rails.log ] > Internal Server Error > /usr/lib/ruby/gems/1.8/gems/aeolus-image-0.3.0/lib/aeolus_image/model/warehouse/warehouse_client.rb:156:in `do_request' > /usr/lib/ruby/gems/1.8/ge