aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/json_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Detect in-place changes on mutable AR attributesSean Griffin2014-06-131-0/+20
| | | | | | We have several mutable types on Active Record now. (Serialized, JSON, HStore). We need to be able to detect if these have been modified in place.
* Rename `type_cast` to `type_cast_from_database`Sean Griffin2014-06-091-4/+4
| | | | | | | | 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.
* Make `_before_type_cast` actually be before type castSean Griffin2014-06-091-0/+1
| | | | | | | | | | | | | - The following is now true for all types, all the time - `model.attribute_before_type_cast == given_value` - `model.attribute == model.save_and_reload.attribute` - `model.attribute == model.dup.attribute` - `model.attribute == YAML.load(YAML.dump(model)).attribute` - Removes the remaining types implementing `type_cast_for_write` - Simplifies the implementation of time zone aware attributes - Brings tz aware attributes closer to being implemented as an attribute decorator - Adds additional point of control for custom types
* Bring type casting behavior of hstore/json in line with serializedSean Griffin2014-06-041-0/+8
| | | | | `@raw_attributes` should not contain the type-cast, mutable version of the value.
* Revert "test pg, we don't care about the internal state of `column#default`."Yves Senn2014-06-031-0/+3
| | | | | | | | | | | | | | Revert "test pg, remove unused column assignments. Follow up to 254cdf47" Related to #15492 This reverts commit 254cdf4728291277f3fbaa854f34495030e476b4. This reverts commit 4bcf9029452e0c760af04faab6b549710401e8cf. There are public methods that assume `Column#default` is type casted. The return value of `Column#default` is publicly relevant and should not change. /cc @sgrif
* test pg, remove unused column assignments. Follow up to 254cdf47Yves Senn2014-06-031-2/+0
|
* test pg, we don't care about the internal state of `column#default`.Yves Senn2014-06-031-1/+0
| | | | | That data is internal to Active Record. What we care about is that new records have the right default value.
* pg, keep `hstore` and `json` attributes as `Hash` in @attributes.Yves Senn2014-05-281-0/+8
| | | | | | | | | | | The solution presented in this patch is not efficient. We should replace it in the near future. The following needs to be worked out: * Is `@attributes` storing the Ruby or SQL representation? * `cacheable_column?` is broken but `hstore` and `json` rely on that behavior Refs #15369. /cc @sgrif @rafaelfranca
* test, use `columns_hash[]` in place of `columns.find {}`.Yves Senn2014-05-121-2/+2
|
* PostgreSQL, test-cases to lock down column default values.Yves Senn2014-03-281-0/+11
|
* PostgreSQL, test cases to lock the current column types.Yves Senn2014-03-281-7/+13
|
* Use teardown helper method.Guo Xiang Tan2014-03-141-1/+1
| | | | | | | | Follow-Up to https://github.com/rails/rails/pull/14348 Ensure that SQLCounter.clear_log is called after each test. This is a step to prevent side effects when running tests. This will allow us to run them in random order.
* no need to `return skip` in tests. `skip` is enough.Yves Senn2014-01-161-1/+1
|
* Tidy up fix for PG extensions quotingCarlos Antonio da Silva2013-12-231-2/+6
| | | | | Always pass in the column for quote_bound_value and quote using it in case it exists there.
* Serialize postgres' hstore, json and array types correctly in AR update methods.Tadas Tamosauskas2013-12-231-0/+6
| | | | | | | | | Fixes #12261. Closes #12395. Conflicts: activerecord/CHANGELOG.md activerecord/test/cases/adapters/postgresql/array_test.rb activerecord/test/cases/adapters/postgresql/json_test.rb
* cast json values on write to be consistent with reading from the db.Severin Schoepke2013-10-251-0/+7
| | | | See also commit 5ac2341fab689344991b2a4817bd2bc8b3edac9d
* test to verify the `ActiveRecord::Store` behavior with PG's json typeYves Senn2013-10-251-0/+18
|
* Add CHANGELOG enty for #11235Rafael Mendonça França2013-07-021-1/+0
|
* Support array as root element in JSONAlexey Noskov2013-05-141-0/+14
|
* Support PostgreSQL specific column types when using `change_table`.Yves Senn2013-02-281-0/+15
| | | | | | | | Closes #9480. We use `TableDefinition` for `#create_table` and `Table` for `#change_table`. The PostgreSQL sepcifc types were only defined on `TableDefinition` so I also added them to `Table`.
* Put the create_table block in a transaction.Rafael Mendonça França2012-09-051-2/+4
| | | | | This will solve the issue that abort the connection transaction when we skip the tests.
* ActiveRecord support to PostgreSQL 9.2 JSON typeDickson S. Guedes2012-09-051-0/+69
This implements the support to encode/decode JSON data to/from database and creating columns of type JSON using a native type [1] supported by PostgreSQL from version 9.2. [1] http://www.postgresql.org/docs/9.2/static/datatype-json.html