1. 03 1月, 2015 21 次提交
    • C
      Deprecate `false` as the way to halt AS callbacks · d217daf6
      claudiob 提交于
      After this commit, returning `false` in a callback will display a deprecation
      warning to make developers aware of the fact that they need to explicitly
      `throw(:abort)` if their intention is to halt a callback chain.
      
      This commit also patches two internal uses of AS::Callbacks (inside
      ActiveRecord and ActionDispatch) which sometimes return `false` but whose
      returned value is not meaningful for the purpose of execution.
      
      In both cases, the returned value is set to `true`, which does not affect the
      execution of the callbacks but prevents unrequested deprecation warnings from
      showing up.
      d217daf6
    • C
      Throw :abort halts default CallbackChains · 2386daab
      claudiob 提交于
      This commit changes arguments and default value of CallbackChain's :terminator
      option.
      
      After this commit, Chains of callbacks defined **without** an explicit
      `:terminator` option will be halted as soon as a `before_` callback throws
      `:abort`.
      
      Chains of callbacks defined **with** a `:terminator` option will maintain their
      existing behavior of halting as soon as a `before_` callback matches the
      terminator's expectation. For instance, ActiveModel's callbacks will still
      halt the chain when a `before_` callback returns `false`.
      2386daab
    • E
      Cleanup methods, missing spacing and missing nodocs · b0d87a72
      eileencodes 提交于
      Add missing nodoc's
      Change `assoc_klass` argument name to `association_klass`
      Change `prev_reflection` argument name to `previous_reflection`
      Change `prev` to `previous_reflection` in `#get_chain`
      Switch use of `refl` and `reflection` in `#get_chain` so main parameter
      is not abbreviated.
      Add missing space in `#add_constraints`
      b0d87a72
    • E
      Move `#type_caster` to alias tracker initialize · 39abe835
      eileencodes 提交于
      This moves the `#type_caster` from the `aliased_table_for` and into the
      initialize of the `alias_tracker`.
      39abe835
    • E
      Add `#all_includes` method to reflections · 96e277c0
      eileencodes 提交于
      `yield` instead of relying on checking if the reflection is equal to the
      `chain_head`.
      96e277c0
    • E
      Initialze `#alias_tracker` with base table name · 0408e212
      eileencodes 提交于
      Instead of initializing an empty connection use the base table name
      instead. Split up and refactor `#create` to be 2 methods `#create` and
      `#create_with_joins`. Removes the need to update the count by 1 on
      initialzing a JoinDependency.
      0408e212
    • E
      Move `alias_candiate` into `AbstractReflection` · 16fafd65
      eileencodes 提交于
      This moves `alias_candidate` out of the `ReflectionProxy` and into the
      `AbstractReflection` so it is shared by all reflections. Change
      `alias_name` to a method and and remove assignment in `#get_chain`.
      16fafd65
    • E
      Pass `connection` rather than `alias_tracker` · cc9b813a
      eileencodes 提交于
      After the refactorings we're only using the connection and not the alias
      tracker anymore. This builds on commit 18019.
      
      Reuse the already available `@connection` to reduce the surface area of
      the alias tracker's API. We can then remove the `attr_reader` because
      the connection is already available.
      cc9b813a
    • E
      Assign the `#alias_name` to each reflection · f6729309
      eileencodes 提交于
      This makes the `#alias_name` more functional.
      f6729309
    • E
      Clean up / refactor new reflection classes · e9684d6c
      eileencodes 提交于
      Move `RuntimeReflection` and `PolymorphicReflect` into Reflection. This
      allows the methods to inherit from `ThroughReflection` and DRY up the
      methods by removing duplicates.
      e9684d6c
    • E
      Refactor `#get_chain` iteration to a linked list · 4d27d56c
      eileencodes 提交于
      The linked list lets us use a loop in `#add_constraints` and completely
      remove the need for indexing the iteration becasue we have access to the
      next item in the chain.
      4d27d56c
    • E
      Refactor `#get_chain` to remove need for `#construct_tables` · 17f6ca1e
      eileencodes 提交于
      By concatnating the `ReflectionProxy` with the `chain` we remove
      the need for `#construct_tables` because the `chain` is now in the
      correct order (order of the chain DOES matter).
      17f6ca1e
    • E
      Move `#alias_name` to `ReflectionProxy` class · 5b0b3cce
      eileencodes 提交于
      Putting the `#alias_name` into ReflectionProxy means we don't have to
      cache the `#alias_name` globally anymore - it's not cached per query.
      5b0b3cce
    • E
      Clean up assignments in `#add_constraints` · 092171da
      eileencodes 提交于
      `is_first_chain`, `items` and `klass` are no longer beneficial and can
      be called directly instead of via their assignments - because they are
      each only used once.
      092171da
    • E
      Refactor construct_tables method · 07668269
      eileencodes 提交于
      Move method structure into reflection classes for accessibly on each
      reflection rather than by traversing the chain.
      07668269
    • E
      Add RuntimeReflection for recursive access to chain · 69d05ae3
      eileencodes 提交于
      The `RuntimeReflection` class allows the reflection to be accessed at
      runtime - then we always know which reflection we are accessing in the
      chain. The `#get_chain` method then allows us to recursively access the
      chain through the `RuntimeReflection`.
      69d05ae3
    • E
      Add PolymorphicReflection and constraints method · 08acb4bc
      eileencodes 提交于
      `#constraints` builds a flattened version of `scope_chain` to
      allow it to be accessible without requiring an index when iterating
      over the `scope_chain`
      08acb4bc
    • R
      Don't test invalid log encoding against PostgreSQL adapter · 9b366b95
      Rafael Mendonça França 提交于
      It already treats the message
      9b366b95
    • R
      A quick pass through NestedAttributes' doc [ci skip] · 4b04fc05
      Robin Dupret 提交于
      4b04fc05
    • R
      Refactor `visit_ChangeColumnDefinition` · 3c10043b
      Ryuta Kamizono 提交于
      `visit_ChangeColumnDefinition` is the same "CHANGE column_name " + `visit_ColumnDefinition(o)`.
      3c10043b
    • R
      Add default value for `create_table_definition` · 84859c45
      Ryuta Kamizono 提交于
      In most cases, `create_table_definition` called by table_name (the first
      argument) only.
      84859c45
  2. 02 1月, 2015 14 次提交
  3. 31 12月, 2014 5 次提交