Hi, I am trying the following in Ruby using InstantRails 1.7 on WindowsXP Publication.find(:all, :include => [:doc_type, :release_state] ) but I get the error: OCIError: ORA-00904: "DOC_TYPES"."PUBLICATION_ID": invalid identifier: SELECT publications.id AS t0_r0, publications.docid AS t0_r1, publications.doc_type_id AS t0_r2, publications.title AS t0_r3, publications.lang AS t0_r4, publications.keywords AS t0_r5, publications.cvsdir AS t0_r6, publications.publishername AS t0_r7, publications.publisherorg AS t0_r8, publications.release_state_id AS t0_r9, doc_types.id AS t1_r0, doc_types.code AS t1_r1, doc_types.en AS t1_r2, doc_types.es AS t1_r3, doc_types.sv AS t1_r4, doc_types.descr AS t1_r5, release_states.id AS t2_r0, release_states.code AS t2_r1, release_states.name AS t2_r2, release_states.descr AS t2_r3 FROM publications LEFT OUTER JOIN doc_types ON doc_types.publication_id publications.id LEFT OUTER JOIN release_states ON release_states.publication_id = publications.id Obviously, the joins should be: LEFT OUTER JOIN doc_types ON doc_types.id = publications.doc_type_id LEFT OUTER JOIN release_states ON release_states.id publications.release_state_id Here is the model: class Publication < ActiveRecord::Base has_many :pub_editions has_one :doc_type has_one :release_state end What''s the problem? Much appreciated, Kevin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
you''re specifying in the wrong way the associations. You need to read the docs about the differences among has_one and belongs_to Probably your model should be more like class Publication < ActiveRecord::Base has_many :pub_editions belongs_to :doc_type belongs_to :release_state end Paolo On 22/05/07, Kevin McNamee <kevin.mcnamee@symsoft.com> wrote:> > Hi, > > I am trying the following in Ruby using InstantRails 1.7 on WindowsXP > > Publication.find(:all, :include => [:doc_type, :release_state] ) > > but I get the error: > > OCIError: ORA-00904: "DOC_TYPES"."PUBLICATION_ID": invalid identifier: > SELECT publications.id AS t0_r0, publications.docid AS t0_r1, > publications.doc_type_id AS t0_r2, publications.title AS t0_r3, > publications.lang AS t0_r4, publications.keywords AS t0_r5, > publications.cvsdir AS t0_r6, publications.publishername AS t0_r7, > publications.publisherorg AS t0_r8, publications.release_state_id AS > t0_r9, doc_types.id AS t1_r0, doc_types.code AS t1_r1, doc_types.en AS > t1_r2, doc_types.es AS t1_r3, doc_types.sv AS t1_r4, doc_types.descr > AS t1_r5, release_states.id AS t2_r0, release_states.code AS t2_r1, > release_states.name AS t2_r2, release_states.descr AS t2_r3 FROM > publications LEFT OUTER JOIN doc_types ON doc_types.publication_id > publications.id LEFT OUTER JOIN release_states ON > release_states.publication_id = publications.id > > Obviously, the joins should be: > > LEFT OUTER JOIN doc_types ON doc_types.id = publications.doc_type_id > LEFT OUTER JOIN release_states ON release_states.id > publications.release_state_id > > Here is the model: > > class Publication < ActiveRecord::Base > has_many :pub_editions > has_one :doc_type > has_one :release_state > end > > > What''s the problem? > > Much appreciated, > Kevin > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Kevin, On 5/22/07, Kevin McNamee <kevin.mcnamee@symsoft.com> wrote:> I am trying the following in Ruby using InstantRails 1.7 on WindowsXP > > Publication.find(:all, :include => [:doc_type, :release_state] ) > > but I get the error:[...]> What''s the problem?Please use the rubyonrails-talk list for support and troubleshooting. The core list is for discussion of Rails internals and implementation. Thanks, jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Possibly Parallel Threads
- Problem with response.should render_template
- undefined method `define_a_column' for class `OCI8::Cursor'
- Weird assignment problem, very confused :(
- how to count totals for each unique name in a table?
- Special characters in Rd example section will cause errors