Search Results

Search found 3 results on 1 pages for 'darkerstar'.

Page 1/1 | 1 

  • Ruby rail debug output

    - by Darkerstar
    Hi all: I am just starting to write ruby rails. I wrote a controller but is getting wrong number of "arguments (1 for 0)" error, I can't understand why. It has no information on where the error occurred? It has a full list of stack traces but my controller file is not in there! In my controller I have just two methods, that I was going to test out activemq. But after I put the controller out, I got the above error, so I commented out all the code, but I still get the same error. I can't figure out why. I searched google for ruby debug, I have not found anything helpful. Here is my controller source: class ActivemqTestController < ApplicationController def send #client = Stomp::Client.open("stomp://localhost:61613") #station_id=101 #data = {'station_id' => station_id, 'username' => 'yangyanzhe'} #client.publish('/listener/add', data) end def receive #client = Stomp::Client.open("stomp://localhost:61613") # Processing loop #client.subscribe('/listener/add', headers) do |msg| # Process your message here # Your submitted data is in msg.body #puts msg['username'] + " joined " + msg['station_id'] + "\n" #client.acknowledge(msg) #end #client.join # Wait until listening thread dies end end This is the error: ArgumentError in Activemq testController#index wrong number of arguments (1 for 0) RAILS_ROOT: D:/rubyapps/radio Application Trace | Framework Trace | Full Trace f:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in `send' f:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in `process_without_filters' f:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:606:in `process' f:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:391:in `process' f:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:386:in `call' f:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:437:in `call' Thank you for any help in advance.

    Read the article

  • ruby rails loop causes server freeze

    - by Darkerstar
    Hi all: I am working on a Ruby on Rails project on Windows. I have Ruby 1.86 and Rails 2.35 installed. Everything is fine until I tried to implement a comet process. I have the following code written to respond to a long poll javascript request. But everytime this function is called, it will hang the whole rails server, no second request can get in, until the timeout. (I know there is juggernaut, but I like to implement one myself first :) Is this due to my server setup? The project will be deployed on a linux server with Ngix and Passenger setup, will it suffer the same problem? def comet_hook timeout(5) do while true do key = 'station_' + station_id.to_s + '_message_lastwrite' if Rails.cache.exist?(key) @cache_time = DateTime.parse(Rails.cache.read(key)) if @cache_time > hook_start @messages = @station.messages_posted_after(hook_start) hook_start = @cache_time break end end end ... end Also with Rails memory store cache, I keep getting "cannot modify frozen object" error, so the above script only worked for me when I switched to File cache. :(

    Read the article

  • Ruby on Rails activerecord find average in one sql and Will_Paginate

    - by Darkerstar
    Hi all I have the following model association: a student model and has_many scores. I need to make a list showing their names and average, min, max scores. So far I am using student.scores.average(:score) on each student, and I realise that it is doing one sql per student. How can I make the list with one joined sql? Also how would I use that with Will_Paginate plugin? Thank you

    Read the article

1