Hi,

I tried to find the manual of sequel combining the result of multiple 
queries. The docs using .merge reflects on a very old version of sequel gem 
and i am trying to combine the query result into one result. I have looked 
at 
http://stackoverflow.com/questions/9540801/combine-two-activerecordrelation-objects
 
but it is only activerecord only and doesn't apply to sequel.

Here is the code which i am trying to do.

class BillingsController < ApplicationController
  def show
    @wifis = Wifi.where(user_id: current_user.id)
      @wifis.each do |wifi|
        billing = Radacct.fetch("SELECT 
radusergroup.username,radusergroup.groupname,radacct.acctstarttime,radacct.acctstoptime
 
FROM radusergroup INNER JOIN radacct ON 
radusergroup.username=radacct.username WHERE calledstationid = ? GROUP BY 
radusergroup.username", wifi.mac_id)
        @billings << billing
      end
  end
end


I am using @billings << billing to add the data but i got this follow error:

F, [2015-12-24T22:59:01.403150 #17112] FATAL -- : 
NoMethodError (undefined method `<<' for nil:NilClass):
  app/controllers/billings_controller.rb:6:in `block in show'
  app/controllers/billings_controller.rb:4:in `show'

I am using Rails 4.2.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to