1. 11 9月, 2016 1 次提交
  2. 07 8月, 2016 1 次提交
  3. 01 2月, 2015 1 次提交
    • S
      Attribute assignment and type casting has nothing to do with columns · 70ac0729
      Sean Griffin 提交于
      It's finally finished!!!!!!! The reason the Attributes API was kept
      private in 4.2 was due to some publicly visible implementation details.
      It was previously implemented by overloading `columns` and
      `columns_hash`, to make them return column objects which were modified
      with the attribute information.
      
      This meant that those methods LIED! We didn't change the database
      schema. We changed the attribute information on the class. That is
      wrong! It should be the other way around, where schema loading just
      calls the attributes API for you. And now it does!
      
      Yes, this means that there is nothing that happens in automatic schema
      loading that you couldn't manually do yourself. (There's still some
      funky cases where we hit the connection adapter that I need to handle,
      before we can turn off automatic schema detection entirely.)
      
      There were a few weird test failures caused by this that had to be
      fixed. The main source came from the fact that the attribute methods are
      now defined in terms of `attribute_names`, which has a clause like
      `return [] unless table_exists?`. I don't *think* this is an issue,
      since the only place this caused failures were in a fake adapter which
      didn't override `table_exists?`.
      
      Additionally, there were a few cases where tests were failing because a
      migration was run, but the model was not reloaded. I'm not sure why
      these started failing from this change, I might need to clear an
      additional cache in `reload_schema_from_cache`. Again, since this is not
      normal usage, and it's expected that `reset_column_information` will be
      called after the table is modified, I don't think it's a problem.
      
      Still, test failures that were unrelated to the change are worrying, and
      I need to dig into them further.
      
      Finally, I spent a lot of time debugging issues with the mutex used in
      `define_attribute_methods`. I think we can just remove that method
      entirely, and define the attribute methods *manually* in the call to
      `define_attribute`, which would simplify the code *tremendously*.
      
      Ok. now to make this damn thing public, and work on moving it up to
      Active Model.
      70ac0729
  4. 09 9月, 2014 1 次提交
    • Y
      Allow included modules to override association methods. · d5580b91
      Yves Senn 提交于
      Closes #16684.
      
      This is achieved by always generating `GeneratedAssociationMethods` when
      `ActiveRecord::Base` is subclassed. When some of the included modules
      of `ActiveRecord::Base` were reordered this behavior was broken as
      `Core#initialize_generated_modules` was no longer called. Meaning that
      the module was generated on first access.
      d5580b91
  5. 17 6月, 2014 1 次提交
    • S
      Promote time zone aware attributes to a first class type decorator · 74af9f7f
      Sean Griffin 提交于
      This refactoring revealed the need for another form of decoration, which
      takes a proc to select which it applies to (There's a *lot* of cases
      where this form can be used). To avoid duplication, we can re-implement
      the old decoration in terms of the proc-based decoration.
      
      The reason we're `instance_exec`ing the matcher is for cases such as
      time zone aware attributes, where a decorator is defined in a parent
      class, and a method called in the matcher is overridden by a child
      class. The matcher will close over the parent, and evaluate in its
      context, which is not the behavior we want.
      74af9f7f
  6. 03 7月, 2013 2 次提交
  7. 26 10月, 2012 1 次提交
    • J
      Remove ActiveRecord::Model · 9e4c41c9
      Jon Leighton 提交于
      In the end I think the pain of implementing this seamlessly was not
      worth the gain provided.
      
      The intention was that it would allow plain ruby objects that might not
      live in your main application to be subclassed and have persistence
      mixed in. But I've decided that the benefit of doing that is not worth
      the amount of complexity that the implementation introduced.
      9e4c41c9
  8. 06 8月, 2012 1 次提交
  9. 03 8月, 2012 1 次提交
  10. 16 6月, 2012 1 次提交
  11. 30 3月, 2012 1 次提交
  12. 21 1月, 2012 1 次提交
  13. 29 12月, 2011 1 次提交
    • J
      Support configuration on ActiveRecord::Model. · 93c1f11c
      Jon Leighton 提交于
      The problem: We need to be able to specify configuration in a way that
      can be inherited to models that include ActiveRecord::Model. So it is
      no longer sufficient to put 'top level' config on ActiveRecord::Base,
      but we do want configuration specified on ActiveRecord::Base and
      descendants to continue to work.
      
      So we need something like class_attribute that can be defined on a
      module but that is inherited when ActiveRecord::Model is included.
      
      The solution: added ActiveModel::Configuration module which provides a
      config_attribute macro. It's a bit specific hence I am not putting this
      in Active Support or making it a 'public API' at present.
      93c1f11c
  14. 24 12月, 2011 3 次提交
  15. 16 12月, 2011 1 次提交
  16. 06 10月, 2011 1 次提交
  17. 05 10月, 2011 1 次提交
  18. 13 9月, 2011 1 次提交
    • J
      Always generate attribute methods on the base class. · eecfa84a
      Jon Leighton 提交于
      This fixes a situation I encountered where a subclass would cache the
      name of a generated attribute method in @_defined_class_methods. Then,
      when the superclass has it's attribute methods undefined, the subclass
      would always have to dispatch through method_missing, because the
      presence of the attribute in @_defined_class_methods would mean that it
      is never generated again, even if undefine_attribute_methods is called
      on the subclass.
      
      There various other confusing edge cases like this. STI classes share
      columns, so let's just keep all the attribute method generation state
      isolated to the base class.
      eecfa84a
  19. 07 6月, 2011 1 次提交
  20. 05 6月, 2011 1 次提交
    • J
      Refactor Active Record test connection setup. Please see the... · 253bb6b9
      Jon Leighton 提交于
      Refactor Active Record test connection setup. Please see the RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
      253bb6b9
  21. 11 4月, 2011 1 次提交
  22. 19 2月, 2011 2 次提交