search for: construct_finder_sql

Displaying 20 results from an estimated 23 matches for "construct_finder_sql".

2008 Sep 17
13
Capturing the sql from a statement without executing it?
Hi guys, Is there an elegant way to capture the sql that would have been executed by an ActiveRecord statement, without actually executing it? :) I''m imagining something like sql = User.find(1).groups.to_sql or perhaps sql = ActiveRecord::Base.capture_sql { User.find(1).groups } resulting in sql = ''SELECT * FROM groups INNER JOIN memberships.... WHERE users.id =
2007 Aug 05
1
Activerecord Query Generation
Is there a way to just retrieve the sql that would be generated by an activerecord call without actually executing the call? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2006 Jan 10
1
sql server freetds/odbc question
...all'' /vendor/rails/activerecord/lib/active_record/connection_adapters/ sqlserver_adapter.rb:354:in `add_limit_offset!'' /vendor/rails/activerecord/lib/active_record/base.rb:931:in `add_limit!'' /vendor/rails/activerecord/lib/active_record/base.rb:924:in `construct_finder_sql'' Any help appreciated! Jamie ------ class ActionController::Base def paginate_with_sort(collection_id, options={}) @params[:sort_direction] ||= ''-1'' asc_desc = {''1'' => "asc", ''-1'' => "desc"}...
2007 Jul 23
2
Firebird, fireruby
.../lib/active_record/ connection_adapters/abstract/connection_specification.rb:78:in `connection'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1139:in `add_limit!'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1101:in `construct_finder_sql'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:997:in `find_every'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:418:in `find'' #{RAILS_ROOT}/app/controllers/users_controller.rb:13:in `index'' Please...
2006 Jan 10
1
sql server & linux: left join problem
...all'' /vendor/rails/activerecord/lib/active_record/connection_adapters/ sqlserver_adapter.rb:354:in `add_limit_offset!'' /vendor/rails/activerecord/lib/active_record/base.rb:931:in `add_limit!'' /vendor/rails/activerecord/lib/active_record/base.rb:924:in `construct_finder_sql'' /vendor/rails/activerecord/lib/active_record/base.rb:395:in `find'' /vendor/rails/actionpack/lib/action_controller/pagination.rb: 174:in `find_collection_for_pagination'' /vendor/rails/actionpack/lib/action_controller/pagination.rb: 192:in `paginator_and_c...
2010 Jan 26
1
Mongrels Hanging in mysql_adapter.rb
...rd/ connection_adapters/abstract/connection_specification.rb:113:in `connection''", "/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb: 2934:in `quoted_table_name''", "/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb: 1626:in `construct_finder_sql''", "/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb: 1490:in `find_every''", "/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb: 589:in `find''", I figured that since I was running a packaged version of mongrel...
2006 Jun 20
2
Problem with "can''t dump anonymous class Class"
...by/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb :1276:in `sanitize_sql'' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb :1062:in `add_conditions!'' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb :1012:in `construct_finder_sql'' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb :924:in `find_every'' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb :918:in `find_initial'' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_recor...
2006 Jul 23
0
[PATCH] (+tests) with_scope :order doesn''t work with included associations
...:include => TEST_INCLUDE }, { :order => TEST_ORDER }) # In these examples, :order is ignored. test_find({ :include => TEST_INCLUDE, :order => TEST_ORDER }, {}) test_find({ :order => TEST_ORDER }, { :include => TEST_INCLUDE }) }}} There''s some code duplication between construct_finder_sql_with_included_associations and the usual construct_finder_sql, and changeset r4274 for ticket #3887 only modified one copy of the duplicate code. -------------- next part -------------- A non-text attachment was scrubbed... Name: with_scope_order_include.diff Type: application/octet-stream Siz...
2006 Mar 31
1
Ruby 1.8.4 upgrade screws up ActiveRecord
.../lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1044:in `add_limit!'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1017:in `construct_finder_sql'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:924:in `find_every'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:381:in `find'' #{RAILS_ROOT}/app/controllers/front_controller.rb:14:in `index'' Line 14...
2008 Mar 18
0
Case sensitive validate_uniqueness_of isn't working
...ike) and sqlite (is case sensitive), but not a general solution. I did this patch that add the test to check that case sensitivity is working and get it to work by doing a ruby (case sensitive) comparison if case sensitive option is given. To achieve this i changed the find for a select_all with a construct_finder_sql, so in case it must compare the value the results aren''t objects to be initialitated. You can find the ticket/patch here: http://dev.rubyonrails.org/ticket/11366 Thank you. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to th...
2007 Jan 10
0
SQLite3::CantOpenException
.../connection_adapters/abstract/connection_specification.rb:78:in ''connection'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1046:in ''add_limit!'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1017:in ''construct_finder_sql'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:924:in ''find_every'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:381:in ''find'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/depre...
2005 Nov 16
4
What happened to mysql connection?
...ib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ active_record/base.rb:253:in `connection'' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ active_record/base.rb:937:in `add_limit!'' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ active_record/base.rb:930:in `construct_finder_sql'' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ active_record/base.rb:411:in `find'' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ active_record/base.rb:409:in `find'' #{RAILS_ROOT}app/controllers/customer_controller.rb:13:in `pre_check''...
2006 Jan 05
2
Rails 1.0 Crashing: Errno::EPIPE (Broken pipe):
...1.8/gems/activerecord-1.13.2/lib/active_record/base .rb:1122:in `sanitize_sql'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base .rb:942:in `add_conditions!'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base .rb:921:in `construct_finder_sql'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base .rb:395:in `find'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base .rb:393:in `find'' /app/models/user.rb:95:in `auth_user'' /app/models/user.r...
2007 Aug 06
4
problem with rails_root
...uby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1387:in `sanitize_sql'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1163:in `add_conditions!'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1096:in `construct_finder_sql'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:997:in `find_every'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:991:in `find_initial'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_reco...
2009 Sep 16
3
find_by_sql - multiple selects, same statement SQL error
I''m trying to get the following statement to work using variable substitution (it works if hard-code the where (med_type) param in the inner SQL statement): med_type = ''game'' @mediaformats = MediaFormat.find_by_sql("select * from media_formats where media_formats.media_type_id = (select media_type_id from media_types where media_type = ?, :med_type) order by
2006 Jul 28
2
Problems connecting to remote mysql db
...dapters/abstract/connection_specification.rb:78:in `connection'' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:1046:in `add_limit!'' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:1017:in `construct_finder_sql'' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:924:in `find_every'' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:381:in `find'' #{RAILS_ROOT}/app/controllers/intro_controller.rb...
2006 Jun 19
3
can''t dump anonymous class Class
I''m trying to create a document upload system, where most of the code is the super class Document and just the path to file on the system is controlled by the sub classes. When I attempt to use my code, I get the following when I try to save the document. can''t dump anonymous class Class Any ideas? ** Migration ** class CreateDocuments < ActiveRecord::Migration def
2007 Nov 14
3
Connecting to Oracle from an Intel Mac -- arch. conflicts
...rd/connection_adapters/abstract/connection_specification.rb:78:in `connection'' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/base.rb:2222:in `quoted_table_name'' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/base.rb:1155:in `construct_finder_sql'' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/base.rb:1035:in `find_every'' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/base.rb:1029:in `find_initial'' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/...
2005 Oct 17
8
Using active record for SELECT MAX(column) FROM ...
Hi, Is there an easy way of querying an active record for a maximum column value? I need to do queries like: SELECT MAX(salary) FROM employees TIA, Jeroen
2006 Apr 01
12
Repost: Why is rails generating bad SQL?
...is configuration, and I can''t quite figure it out. I''ve instrumented ActiveRecord enough to localize the problem somewhat, and generally by this time I would have a good idea of what I was missing because it''s all in the source. It appears that something in ActiveRecord.construct_finder_sql is choking on something I am doing. Any ideas would be appreciated. Thanks in advance, David Johnson Here''s my code that is failing: -------------------------------- def create # changed because we are instantiating the presentations here # may not be needed if we instantiate prese...