This looks good to me, but it returns a syntax error a "...,@params[:id])" ^ Can anyone tell my why? def list_for_location @voice_circuit_pages, @voice_circuits = paginate :VoiceCircuit.find(:all, :conditions => "location_id = ?", @params[:id]), :per_page => 25 #@voice_circuit_pages, @voice_circuits = paginate :voice_circuit_for_location( @params[''id'']), :per_page => 25 end -- Best Regards, -Larry "Work, work, work...there is no satisfactory alternative." --- E.Taft Benson _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 8/16/05, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> :conditions => "location_id = ?", @params[:id]Try: :conditions => ["location_id = ?", @params[:id]] Tyler
You''re not using the placeholder correctly in find(). It should be: VoiceCircuit.find(:all, :conditions => ["location_id = ?", @params[:id]]) On 8/16/05, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> This looks good to me, but it returns a syntax error a "...,@params[:id])" > > > ^ > Can anyone tell my why? > > > def list_for_location > @voice_circuit_pages, @voice_circuits = paginate > :VoiceCircuit.find(:all, :conditions => "location_id = ?", @params[:id]), > :per_page => 25 > #@voice_circuit_pages, @voice_circuits = paginate > :voice_circuit_for_location( @params[''id'']), :per_page => 25 > end > > -- > Best Regards, > -Larry > "Work, work, work...there is no satisfactory alternative." > --- E.Taft Benson > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Thanks, no syntax error. But, it returns all the table data, not just those rows where: location_id = 3 How can I get rails to show the actual SQL query that it is passing to the db? -L On 8/16/05, Pat Maddox <pergesu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > You''re not using the placeholder correctly in find(). It should be: > > VoiceCircuit.find(:all, :conditions => ["location_id = ?", @params[:id]]) > > > On 8/16/05, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > This looks good to me, but it returns a syntax error a > "...,@params[:id])" > > > > > > ^ > > Can anyone tell my why? > > > > > > def list_for_location > > @voice_circuit_pages, @voice_circuits = paginate > > :VoiceCircuit.find(:all, :conditions => "location_id = ?", > @params[:id]), > > :per_page => 25 > > #@voice_circuit_pages, @voice_circuits = paginate > > :voice_circuit_for_location( @params[''id'']), :per_page => 25 > > end > > > > -- > > Best Regards, > > -Larry > > "Work, work, work...there is no satisfactory alternative." > > --- E.Taft Benson > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Best Regards, -Larry "Work, work, work...there is no satisfactory alternative." --- E.Taft Benson _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 8/16/05, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How can I get rails to show the actual SQL query that it is passing to the > db? > -Ltake a look at logs/development.log
Larry Kelly wrote:> Thanks, no syntax error. But, it returns all the table data, not just > those rows where: > location_id = 3 > > How can I get rails to show the actual SQL query that it is passing to > the db? > -LIt''s all logged to development.log, so take a look at that. Tailing the log is quite handy whilst developing. tail -f log/development.log If on windows (and so don''t have tail), I recommend getting a copy of cygwin [1] or unix tools [2]. Very handy for development work. hth [1] http://cygwin.com/ [2] http://unxutils.sourceforge.net/ -- R.Livsey http://livsey.org
Richard Livsey wrote:> tail -f log/development.logObviously that should be ''logs/development.log'' -- R.Livsey http://livsey.org
Good advice, after all, there''s more to life than ''point and click'' ;) But, I don''t feel comfortable installing cygwin on Windows 2003 server, yet. Afraid, I''d be tempted to continue on and install lighttpd as well. I check out linuxutils, though. -L On 8/16/05, Richard Livsey <richard-gfRugNUWsoQdnm+yROfE0A@public.gmane.org> wrote:> > > If on windows (and so don''t have tail), I recommend getting a copy of > cygwin [1] or unix tools [2]. Very handy for development work. > > hth > > [1] http://cygwin.com/ > [2] http://unxutils.sourceforge.net/ > > -- > R.Livsey > http://livsey.org > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Best Regards, -Larry "Work, work, work...there is no satisfactory alternative." --- E.Taft Benson _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails