-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ActiveRecord 4.2 #145
ActiveRecord 4.2 #145
Conversation
PostgreSQLAdapter module was renamed to PostgreSQL: see rails/rails@cea481699
* Register types in adapter by overriding #initialize_type_map * Add #new_column override * Rename oid_type to cast_type
Fix deprecation warning: “Calling `cached_attributes` is no longer necessary. All attributes are cached.”
* Fix ActiveSupport::TestCase warnings
Certainly a good step in the right direction, things seem to sort of be working for me. I'm having issues assigning to spatial collections, so assuming Location has a spatial point column called center Given I'm not familiar with the fine details of how this gem works or have a much of a GIS background, I've hacked my way round the above issues by using the following for OID::Spatial
I'll let someone manually review that. As you can tell in my case thing where failing because I was assigning an RGeo object directly rather than WKB. I assume we need to cater for WKT as well? |
Not sure if this is on your radar - One other thing in migrations I noticed |
@virtualfunction thanks - that helped Much of the functionality in the |
* Simplify comments
* Change base class from Type::String to Type::Value * Move methods into OID::Spatial * Add OID::Spatial#spatial? * Fix SpatialColumn#spatial?
* Update #column signature to match parent * Remove unnecessary module scope
* Remove unnecessary module scope
* Bump development version dependencies for rake, mocha
* Fix method signature
* The only types that will ever be passed to #type_to_sql are :geometry and :geography * Improve comments
* rgeo-activerecord 2.1 removes the spatial index schema hack * Fix tests
Conflicts: README.md
AR-JDBC does not yet support AR 4.2
Tests are passing locally for me with ruby 2.1.5 (most of the time). This is really close... |
4dc7c14
to
6ecacc4
Compare
* Postgres 9.3 is latest, pre-installed with PostGIS 2.1 * Move separate config scripts into .travis.yml
6ecacc4
to
d200cb6
Compare
* Remove dependence on RGeo::ActiveRecord::AdapterTestHelper
* Remove dependency on RGeo::ActiveRecord::AdapterTestHelper
* Remove dependency on RGeo::ActiveRecord::AdapterTestHelper * Use SpatialModel * Move model creation to private method #create_model
Not sure what the point of that method is, or if it’s this adapter’s reponsibiliy. The tests fail on Travis & work locally.
@teeparham thanks a lot for the hard work, working great in our app! Do you plan a gem release soon? 💟 |
This branch is released as 3.0.0.beta1. Test with: gem "activerecord-postgis-adapter", "3.0.0.beta1" Unless there are major problems, I will be merging this into master soon and releasing 3.0.0. |
|
I'm unclear to the internals of this adapter, but I think something may be off here: In a migration: class CreateTrackPoints < ActiveRecord::Migration
def change
create_table :track_points do |t|
t.st_point :coordinate, geographic: true
end
end
end Executing this writes out this into my create_table "track_points", force: :cascade do |t|
t.geography "coordinate", limit: {:srid=>4326, :type=>"point", :geographic=>true}
end That's fine and well, but any time I attempt to run any rake command involving
Would it make sense to have the adapter write out the following statement instead into schema.rb? + t.st_point "coordinate", :geographic=>true
- t.geography "coordinate", limit: {:srid=>4326, :type=>"point", :geographic=>true} Doing so seems to fix the problem. |
I'm merging this into master, although it's not quite ready for a 3.0.0 release yet. Please open bugs (like the one above) as individual issues. |
Will do. |
@averas I'm running into that same issue. Did you figure anything out for it?
|
This branch is released as 3.0.0.beta1. Test with:
There are significant changes to the PostgreSQL adapter in ActiveRecord 4.2, and it is extremely cumbersome to support prior versions in a single code base. Therefore, instead of having conditional support for prior versions of ActiveRecord, this adapter will only support ActiveRecord 4.2 and later in the master branch and version 3.0.
activerecord-postgis-adapter
version 2.x will continue to support ActiveRecord 4.0 and 4.1.activerecord-postgis-adapter
version 3.x will support ActiveRecord 4.2 and later.