1. 13 6月, 2014 1 次提交
  2. 10 6月, 2014 1 次提交
    • S
      Rename `type_cast` to `type_cast_from_database` · d24e6407
      Sean Griffin 提交于
      In some cases there is a difference between the two, we should always
      be doing one or the other. For convenience, `type_cast` is still a
      private method on type, so new types that do not need different behavior
      don't need to implement two methods, but it has been moved to private so
      it cannot be used accidentally.
      d24e6407
  3. 07 6月, 2014 1 次提交
  4. 04 6月, 2014 1 次提交
  5. 27 5月, 2014 1 次提交
  6. 26 5月, 2014 1 次提交
    • S
      Add missing test case for quoting behavior · a8afc639
      Sean Griffin 提交于
      It appears that the only time that `quote` is called with a column,
      but without first calling `type_cast` is when where is called with an
      array. My previous pull request broke this behavior, without failing
      tests. This adds a test for the only case I can think of that exercises
      the `if column.type == :integer` branch of `quote` effectively.
      a8afc639
  7. 24 5月, 2014 1 次提交
    • S
      Remove `Column#primary` · 05dd3df3
      Sean Griffin 提交于
      It appears to have been used at some point in the past, but is no longer
      used in any meaningful way. Whether a column is considered primary is
      a property of the model, not the schema/column. This also removes the
      need for yet another layer of caching of the model's schema, and we can
      leave that to the schema cache.
      05dd3df3
  8. 19 5月, 2014 1 次提交
  9. 18 5月, 2014 1 次提交
  10. 12 4月, 2014 3 次提交
  11. 29 3月, 2014 1 次提交
  12. 12 3月, 2014 1 次提交
  13. 21 1月, 2014 1 次提交
    • J
      Ensure #second acts like #first AR finder · cafe31a0
      Jason Meller 提交于
      This commit bring the famous ordinal Array instance methods defined
      in ActiveSupport into ActiveRecord as fully-fledged finders.
      
      These finders ensure a default ascending order of the table's primary
      key, and utilize the OFFSET SQL verb to locate the user's desired
      record. If an offset is defined in the query, calling #second adds
      to the offset to get the actual desired record.
      
      Fixes #13743.
      cafe31a0
  14. 18 1月, 2014 1 次提交
  15. 16 1月, 2014 2 次提交
    • Y
      reset column information after fiddling with `Encoding.default_internal` · 6eab5304
      Yves Senn 提交于
      This solves order depndent problems in `base_test.rb`. The leaked column
      information crashed test cases using the `Weird` class later on:
      
      ```
        2) Error:
      BasicsTest#test_group_weirds_by_from:
      SyntaxError: /Users/senny/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:387: invalid hex escape
      ... attribute_before_type_cast("\x{A4CA}\x{A4DE}\x{A4A8}", *arg...
      ...                               ^
      /Users/senny/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:387: invalid hex escape
      ...te_before_type_cast("\x{A4CA}\x{A4DE}\x{A4A8}", *args)
      ...                               ^
      /Users/senny/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:387: invalid hex escape
      ...e_type_cast("\x{A4CA}\x{A4DE}\x{A4A8}", *args)
      ...                               ^
          /Users/senny/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:385:in `module_eval'
          /Users/senny/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:385:in `define_proxy_call'
          /Users/senny/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:294:in `block in define_attribute_method'
          /Users/senny/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:285:in `each'
          /Users/senny/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:285:in `define_attribute_method'
          /Users/senny/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:252:in `block in define_attribute_methods'
          /Users/senny/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:252:in `each'
          /Users/senny/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:252:in `define_attribute_methods'
          /Users/senny/Projects/rails/activerecord/lib/active_record/attribute_methods.rb:72:in `block in define_attribute_methods'
          /Users/senny/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/mutex_m.rb:73:in `synchronize'
          /Users/senny/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/mutex_m.rb:73:in `mu_synchronize'
          /Users/senny/Projects/rails/activerecord/lib/active_record/attribute_methods.rb:69:in `define_attribute_methods'
          /Users/senny/Projects/rails/activerecord/lib/active_record/attribute_methods.rb:174:in `method_missing'
          /Users/senny/Projects/rails/activerecord/lib/active_record/attribute_assignment.rb:45:in `public_send'
          /Users/senny/Projects/rails/activerecord/lib/active_record/attribute_assignment.rb:45:in `_assign_attribute'
          /Users/senny/Projects/rails/activerecord/lib/active_record/attribute_assignment.rb:32:in `block in assign_attributes'
          /Users/senny/Projects/rails/activerecord/lib/active_record/attribute_assignment.rb:26:in `each'
          /Users/senny/Projects/rails/activerecord/lib/active_record/attribute_assignment.rb:26:in `assign_attributes'
          /Users/senny/Projects/rails/activerecord/lib/active_record/core.rb:458:in `init_attributes'
          /Users/senny/Projects/rails/activerecord/lib/active_record/core.rb:191:in `initialize'
          /Users/senny/Projects/rails/activerecord/lib/active_record/inheritance.rb:30:in `new'
          /Users/senny/Projects/rails/activerecord/lib/active_record/inheritance.rb:30:in `new'
          /Users/senny/Projects/rails/activerecord/lib/active_record/persistence.rb:33:in `create'
          test/cases/base_test.rb:646:in `test_group_weirds_by_from'
      ```
      6eab5304
    • Y
      no need to `return skip` in tests. `skip` is enough. · a6512cbd
      Yves Senn 提交于
      a6512cbd
  16. 14 1月, 2014 1 次提交
  17. 17 12月, 2013 1 次提交
  18. 08 11月, 2013 1 次提交
  19. 05 11月, 2013 1 次提交
  20. 03 11月, 2013 2 次提交
  21. 31 10月, 2013 1 次提交
  22. 25 10月, 2013 1 次提交
  23. 30 9月, 2013 1 次提交
    • Y
      fix `test_sqlite3_mem` test run. · 93899335
      Yves Senn 提交于
      marshalling between processes does not work with an in-memory db.
      This breaks the `test_sqlite3_mem` run (see stacktrace below).
      After that failure most tests start to fail randomly.
      
      ```
      /Users/senny/Projects/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:512:in `table_structure': Could not find table 'posts' (ActiveRecord::StatementInvalid)
      	from /Users/senny/Projects/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:399:in `columns'
      	from /Users/senny/Projects/rails/activerecord/lib/active_record/connection_adapters/schema_cache.rb:93:in `block in prepare_default_proc'
      	from /Users/senny/Projects/rails/activerecord/lib/active_record/connection_adapters/schema_cache.rb:44:in `yield'
      	from /Users/senny/Projects/rails/activerecord/lib/active_record/connection_adapters/schema_cache.rb:44:in `columns'
      	from /Users/senny/Projects/rails/activerecord/lib/active_record/model_schema.rb:208:in `columns'
      	from /Users/senny/Projects/rails/activerecord/lib/active_record/model_schema.rb:249:in `column_defaults'
      	from /Users/senny/Projects/rails/activerecord/lib/active_record/locking/optimistic.rb:171:in `column_defaults'
      	from /Users/senny/Projects/rails/activerecord/lib/active_record/core.rb:167:in `initialize'
      	from /Users/senny/Projects/rails/activerecord/lib/active_record/inheritance.rb:27:in `new'
      	from /Users/senny/Projects/rails/activerecord/lib/active_record/inheritance.rb:27:in `new'
      	from /Users/senny/Projects/rails/activerecord/test/cases/base_test.rb:1368:in `block in test_marshal_between_processes'
      	from /Users/senny/Projects/rails/activerecord/test/cases/base_test.rb:1366:in `fork'
      	from /Users/senny/Projects/rails/activerecord/test/cases/base_test.rb:1366:in `test_marshal_between_processes'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest/test.rb:110:in `block (3 levels) in run'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest/test.rb:208:in `capture_exceptions'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest/test.rb:107:in `block (2 levels) in run'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest/test.rb:260:in `time_it'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest/test.rb:106:in `block in run'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest.rb:296:in `on_signal'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest/test.rb:280:in `with_info_handler'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest/test.rb:105:in `run'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest.rb:268:in `block (2 levels) in run'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest.rb:267:in `each'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest.rb:267:in `block in run'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest.rb:296:in `on_signal'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest.rb:285:in `with_info_handler'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest.rb:266:in `run'
      	from /Users/senny/Projects/rails/activesupport/lib/active_support/test_case.rb:31:in `block in __run'
      	from /Users/senny/Projects/rails/activesupport/lib/active_support/test_case.rb:31:in `map'
      	from /Users/senny/Projects/rails/activesupport/lib/active_support/test_case.rb:31:in `__run'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest.rb:115:in `run'
      	from /Users/senny/Projects/rails/.bundle/gems/minitest-5.0.8/lib/minitest.rb:46:in `block in autorun'
      ```
      
      /cc @tenderlove
      93899335
  24. 28 9月, 2013 2 次提交
  25. 19 9月, 2013 4 次提交
  26. 12 9月, 2013 1 次提交
    • R
      Check if the SQL is not a prepared statement · f13b2785
      Rafael Mendonça França 提交于
      When the adapter is with prepared statement disabled and the binds array
      is not empty the connection adapter will try to set the binds values and
      will fail. Now we are checking if the adapter has the prepared statement
      disabled.
      
      Fixes #12023
      f13b2785
  27. 01 9月, 2013 4 次提交
  28. 31 8月, 2013 2 次提交