I am a RAILS beginner and have been building an application that has
quite a few models in it. The problem I encounter is the following:
There are three models: Contig, Intergenic, Longshortgene
A contig has many intergenics and many longshortgenes.
One of the fields in Intergenic is of the form A-B, where A and B are
From the intergenics view, I would like to use A and B, in separate
calls, to find any longshortgenes that have the same geneid (A or B)
and belong to the same contig as the intergenics object.
My intergenics controller's "show" method is as follows:
@intergenic = Intergenic.find(params[:id])
genearr.each do |gene|
@longgenes = @intergenic.ls_neighborhood(gene, 'LONG')
@shortgenes = @intergenic.ls_neighborhood(gene, 'SHORT')
render :action => 'list'
My model intergenic.rb contains the following:
Longshortgene.find_by_sql["select l.geneid from longshortgenes l
where l.geneid=? and l.contig_id=? and
From the "show" view, I just try to access @longgenes and @shortgenes
and do something with them.
Until I inserted the above blocks of code, my application was
functional. Now I get the following error:
ArgumentError in IntergenicsController#show
wrong number of arguments (4 for 1)
Application Trace | Framework Trace | Full Trace
Could someone please point out what I am doing wrong?
Thank you very much!