Reputation: 1
I'm a bit stuck on a problem here in Rails that I feel may have a simple solution.
I have a class called "CircuitVw" which looks like the following
class CircuitVw < ActiveRecord::Base
self.table_name = 'mvw_circuits'
self.primary_key = :serv_item_id
Inside the controller, I've been able to pull back data using the following format
CircuitVw.all().order("customer_name DESC").each do | circuit |
@customer[ "#{circuit.customer_name}" ] = circuit.psr
end
However, when I try and access the table written this way, I get an uninitialized constant
MVW_CIRCUITS.where("activity_ind IN ( 'Pending', 'In Progress')").order("document_number DESC").each do | circuit |
@psr[ "#{circuit.psr} - #{circuit.customer_name}" ] = circuit.psr
end
Even though I can say something like
SELECT * FROM MVW_CIRCUITS
And return the entire table in the console for my staging environment.
What am I doing wrong here?
The table exists in the schema as
create_table "mvw_circuits", id: false, force: true do |t|
for reference.
Thanks for any insights you might have! Maybe I'm forgetting something dumb. Appreciate any and all help.
Upvotes: 0
Views: 842
Reputation: 30071
You have to use CircuitVw
to access or refer to the table mvw_circuits
. You specified that in the CircuitVw
class. So MVW_CIRCUITS
is an uninitialized constant.
Try this one
CircuitVw.where("activity_ind IN ('Pending', 'In Progress')")
Upvotes: 2