Commit Graph

44119 Commits

Author SHA1 Message Date
Rafael Mendonça França
70ec49c87a Merge pull request #15254 from DNNX/formatter-refactoring-3
Rename `stack` to `queue`
2014-05-22 16:02:23 -03:00
Sean Griffin
57cc778fc8 Push scale to type objects
Ideally types will be usable without having to specify a sql type
string, so we should keep the information related to parsing them on the
adapter or another object.
2014-05-22 11:51:59 -07:00
Rafael Mendonça França
3b814ed2b5 Merge pull request #15239 from croaky/dc-sg-move-extract-precision-to-types
Move `extract_precision` onto type objects
2014-05-22 15:47:46 -03:00
Dan Croak and Sean Griffin
5540005218 Move extract_precision onto type objects 2014-05-22 11:44:02 -07:00
Rafael Mendonça França
35c160066a Merge pull request #15252 from DNNX/formatter-refactoring-2
Remove unnecessary `Hash#to_a` call
2014-05-22 15:40:15 -03:00
Viktar Basharymau
2dafd87edd Rename stack to queue
Because it is used as a queue (FIFO), not as a stack (LIFO).

* http://en.wikipedia.org/wiki/Stack_(abstract_data_type)
* http://en.wikipedia.org/wiki/Queue_(data_structure)
2014-05-22 21:33:26 +03:00
Viktar Basharymau
ee92c61689 Remove unnecessary Hash#to_a call
Inspired by 931ee4186b

```ruby

def stat(num)
  start = GC.stat(:total_allocated_object)
  num.times { yield }
  total_obj_count = GC.stat(:total_allocated_object) - start
  puts "#{total_obj_count / num} allocations per call"
end

h = { 'x' => 'y' }

stat(100) { h.     each { |pair| pair } }
stat(100) { h.to_a.each { |pair| pair } }

__END__
1 allocations per call
2 allocations per call
```
2014-05-22 21:16:56 +03:00
Rafael Mendonça França
d0f0fcf2e9 Merge pull request #15247 from DNNX/activesupport-formatter-refactoring
Use `break` instead of `next` in AD::Journey::Formatter#match_route
2014-05-22 14:03:24 -03:00
Rafael Mendonça França
b343e31097 Merge pull request #15249 from sgrif/sg-register-types-in-adapter
Use the generic type map for all PG type registrations
2014-05-22 13:59:18 -03:00
Rafael Mendonça França
71248fc89e Merge pull request #15248 from sgrif/sg-additional-type-map-args
Allow additional arguments to be used during type map lookups
2014-05-22 13:57:53 -03:00
Sean Griffin
4826a4ab34 Use the generic type map for all PG type registrations
We're going to want all of the benefits of the type map object for
registrations, including block registration and real aliasing. Moves
type name registrations to the adapter, and aliases the OIDs to the
named types
2014-05-22 09:43:30 -07:00
Sean Griffin
ecf4ad7cca Allow additional arguments to be used during type map lookups
Determining things like precision and scale in postgresql will require
the given blocks to take additional arguments besides the OID.

- Adds the ability to handle additional arguments to `TypeMap`
- Passes the column type to blocks when looking up PG types
2014-05-22 09:14:15 -07:00
Rafael Mendonça França
39473053fc Merge pull request #15242 from JuanitoFatas/guides-anchor
[Guides] Do not gsub non ASCII characters in header anchor.
2014-05-22 12:00:33 -03:00
Rafael Mendonça França
9086f61b8e Fix the hash key being delete from env
It was changed by mistake at c5d64b2b86aa42f57881091491ee289b3c489c7e.
2014-05-22 11:49:29 -03:00
Viktar Basharymau
eba8b70d4e Use break instead of next in AD::Journey::Formatter#match_route
The array is sorted in descending order, so there is no point in
iterating further if we met a negative item - all the rest will be
negative too.
2014-05-22 17:44:25 +03:00
Yves Senn
66dd216705 pg test, extract tsvector tests into postgresql/full_text_test.rb 2014-05-22 10:18:04 +02:00
Yves Senn
e4cdf35d64 pg test, move timestamp tests over to postgresql/timestamp_test.rb. 2014-05-22 10:18:04 +02:00
Yves Senn
3ac07aa1d7 pg test, extract network address type tests into separate file. 2014-05-22 10:18:04 +02:00
Juanito Fatas
699babe8e3 Do not gsub non ASCII characters in header anchor. 2014-05-22 16:14:31 +08:00
Yves Senn
a3897f9c06 pg test, remove unused code. 2014-05-22 09:56:26 +02:00
Andrew White
6ffe92939c Merge pull request #15101 from tgxworld/improve_performance_of_building_uri
Form full URI as string to be parsed in Rack::Test.
2014-05-22 08:26:58 +01:00
Guo Xiang Tan
4fd144dd4b Form full URI as string to be parsed in Rack::Test.
There are performance gains to be made by avoiding URI setter methods.
2014-05-21 23:17:17 -07:00
Matthew Draper
110d3d0c0b Merge pull request #14803 from kuldeepaggarwal/null_relation_sum_fix
Fixed a problem where `sum` used with a `group` was not returning a Hash.
2014-05-22 14:59:23 +09:30
Guillermo Iguaran
a0155b2f55 Update CHANGELOG.md
Most recent change should be moved to the top
2014-05-21 22:20:37 -05:00
Guillermo Iguaran
88a3a5db5e Merge pull request #15215 from JohnKellyFerguson/rename-posts-to-articles
Documentation: Rename Posts to Articles
2014-05-21 22:18:57 -05:00
John Kelly Ferguson
d02c810e29 Rename Posts to Articles in Guides, continuation of 2d446e77 / #13774 [ci skip] 2014-05-21 23:01:45 -04:00
Rafael Mendonça França
2fb2913b35 Merge pull request #15237 from sgrif/sg-move-extract-scale
Move extract_scale to decimal type
2014-05-21 21:47:53 -03:00
Rafael Mendonça França
62bcf81431 Merge pull request #15218 from sgrif/sg-move-oid-types
Move PG OID types to their own files
2014-05-21 21:47:06 -03:00
Aaron Patterson
b754d9b56d drop hash allocations during match 2014-05-21 16:33:06 -07:00
Aaron Patterson
6bd9ade062 fewer object allocations and method calls during route match 2014-05-21 16:21:33 -07:00
Aaron Patterson
dd1f23df7b middle variable is never used, so rm 2014-05-21 16:12:49 -07:00
Aaron Patterson
c5d64b2b86 use the existing constant rather than the hardcoded string
so tht I don't go totally insane with THsi crazy hash driven
development. why is Everything a hash? Why do people think hashes in
hashes with random keys is a Good API? You can't find things or
deprecate them or control access whatsoever, you just have to hope that
everyone is like "oh, you want to change that? that's cool! we all know
it's hashes so go for it!"

The End.
2014-05-21 16:07:57 -07:00
Aaron Patterson
15adf778af remove dead code. @klass isn't used anymore 2014-05-21 15:54:29 -07:00
Aaron Patterson
40e77636a3 we can just use Ruby here 2014-05-21 15:51:28 -07:00
Sean Griffin
e45e4f44e3 Move extract_scale to decimal type
The only type that has a scale is decimal. There's a special case where
decimal columns with 0 scale are type cast to integers if the scale is
not specified. Appears to only affect schema dumping.
2014-05-21 15:07:29 -07:00
Aaron Patterson
4d1b3a1312 reuse path formatter from the non-optimized path.
The optimized and non-optimized path share more code now without
significant performance degretation
2014-05-21 14:27:30 -07:00
Aaron Patterson
931ee4186b reduce object allocations
Example:

x = [1,2,3,4]
y = [3,2,1]

def test x, y
  hash = {}
  x.zip(y) { |k,v| hash[k] = v }
  hash
end

def test2 x, y
  Hash[x.zip(y)]
end

def test3 x, y
  x.zip(y).each_with_object({}) { |(k,v),hash| hash[k] = v }
end

def stat num
  start = GC.stat(:total_allocated_object)
  num.times { yield }
  total_obj_count = GC.stat(:total_allocated_object) - start
  puts "#{total_obj_count / num} allocations per call"
end

stat(100) { test(x,y) }
stat(100) { test2(x,y) }
stat(100) { test3(x,y) }

__END__
2 allocations per call
7 allocations per call
8 allocations per call
2014-05-21 14:27:30 -07:00
Aaron Patterson
da83a6f126 make variable name more clear 2014-05-21 14:27:30 -07:00
Aaron Patterson
7bc25f0035 do not mutate parameters, let the caller do mutations 2014-05-21 14:27:30 -07:00
Aaron Patterson
620cb01676 push the formatter up to the Route object 2014-05-21 14:27:30 -07:00
Guillermo Iguaran
e17aead83c Merge pull request #15231 from khusnetdinov/fix_typo_guides_active_support_instrumentation
Fix typo guides/source/active_support_instrumentation.md [ci-skip]
2014-05-21 15:12:54 -05:00
Marat Khusnetdinov
decd92b6fb Fix typo guides/source/active_support_instrumentation.md 2014-05-22 00:00:55 +04:00
Rafael Mendonça França
465736bf85 Merge pull request #15229 from peeyushsingla/master
fixes in active record query for reorder in rails guides
2014-05-21 15:30:38 -03:00
peeyush
18c5f4ef9d fixes in active record query for reorder 2014-05-21 23:40:19 +05:30
Rafael Mendonça França
5335f4c080 Merge pull request #15227 from sgrif/sg-rename-oid-type
Rename `oid_type` to `cast_type` to make PG columns consistent with abstract columns
2014-05-21 14:56:23 -03:00
Sean Griffin
b871b3fab5 Rename oid_type to cast_type to make PG columns consistent 2014-05-21 10:11:30 -07:00
Rafael Mendonça França
b042f21c93 Merge pull request #15219 from sgrif/sg-missing-nodoc
Add missing nodoc
2014-05-21 12:42:47 -03:00
Rafael Mendonça França
94e7dbce8a Merge pull request #14613 from Sirupsen/fix-serialize-update-column
Fix serialized field returning serialized data after update_column

Conflicts:
	activerecord/CHANGELOG.md
2014-05-21 12:38:11 -03:00
Rafael Mendonça França
6931bed1b4 Revert "Merge pull request #14544 from jefflai2/named_scope_sti"
This reverts commit 9a1abedcdeecd9464668695d4f9c1d55a2fd9332, reversing
changes made to c72d6c91a7c0c2dc81cc857a1d6db496e84e0065.

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/test/models/comment.rb

This change break integration with activerecord-deprecated_finders so
I'm reverting until we find a way to make it work with this gem.
2014-05-21 12:15:57 -03:00
Sean Griffin
89357455eb Add missing nodocs to MySQL adapter 2014-05-21 08:08:51 -07:00