paginative 0.0.8 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50ae7b425433ba6ce629752c3648cf7e45dca111
4
- data.tar.gz: 3868c57e3e2146e4b4c5afb4c237d755e2353496
3
+ metadata.gz: cddedd919c12871404bc714b08dbfe1c0132f8de
4
+ data.tar.gz: 30989c919ef281f875555229451a89910eb9b4b7
5
5
  SHA512:
6
- metadata.gz: 9f3886ed72499cf45372c4040d0da5675f5c034818605c71323ca365b6bf09a24b2960aae424db669bc7ca5d0cc9e233f491a2bba7a749e8d64b1567ad8b0837
7
- data.tar.gz: 7b16a2e5ded25b7deb22b68226963b28b1cd28942a9e1dfa2952ba033bb6e1b2e9d41af86f9e3b4ae0e4cafb844a56c4a55c27065519d1db5f9adaa90be58719
6
+ metadata.gz: e237a0c2f5c73b760146a58da1151b4364b7ee6bc0f077a5cb8e4f4587d2c1d681cd95aa13ebdde7e77f96d0e7aadf0fcab0e12037eba0e611855fcc88827d63
7
+ data.tar.gz: 62cc03a5ea20a24e5f77240dfc6c4179cbdc1502b9d9575399054e1e29edd1795a71a6a2729c19ec7a70bdc0bb1d86a8c74af71df31f9ce197c1cd2b484717d0
@@ -5,7 +5,7 @@ module Paginative
5
5
  included do
6
6
  def self.by_distance_from(latitude, longitude, distance=0, limit=25)
7
7
  return [] unless latitude.present? && longitude.present?
8
- distance_sql = send(:distance_sql, latitude.to_f, longitude.to_f, {:units => :km, select_bearing: false})
8
+ distance_sql = send(:distance_sql, latitude.to_f, longitude.to_f, {:units => :km, select_bearing: false, order: "distance ASC"})
9
9
 
10
10
  self.where("#{distance_sql} > #{distance}").offset(0).limit(limit)
11
11
  end
@@ -21,6 +21,10 @@ module Paginative
21
21
 
22
22
  def self.with_field_from(field="", value="", limit=25, order="asc")
23
23
  field = "#{self.name.tableize}.#{field}"
24
+
25
+ #replaces the / when tableizing a namespaced class
26
+ field = field.sub('/','_')
27
+
24
28
  return self.order("#{field} DESC").where("#{field} < '#{value}'").limit(limit) if order == "desc"
25
29
  self.order("#{field} ASC").where("#{field} > '#{value}'").limit(limit)
26
30
  end
@@ -1,3 +1,3 @@
1
1
  module Paginative
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.11"
3
3
  end
Binary file
Binary file
@@ -0,0 +1,83 @@
1
+  (2.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
2
+  (0.4ms) select sqlite_version(*)
3
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
5
+ Migrating to CreatePaginativeTestModels (20140415060518)
6
+  (0.1ms) begin transaction
7
+  (0.6ms) CREATE TABLE "paginative_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "latitude" float, "longitude" float, "created_at" datetime, "updated_at" datetime)
8
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140415060518"]]
9
+  (0.8ms) commit transaction
10
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
11
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
12
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
13
+  (1.1ms) CREATE TABLE "paginative_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "latitude" float, "longitude" float, "created_at" datetime, "updated_at" datetime) 
14
+  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
15
+  (0.4ms) select sqlite_version(*)
16
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
17
+  (0.1ms) SELECT version FROM "schema_migrations"
18
+  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20140415060518')
19
+  (1.2ms) CREATE TABLE "paginative_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "latitude" float, "longitude" float, "created_at" datetime, "updated_at" datetime) 
20
+  (2.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
21
+  (0.2ms) select sqlite_version(*)
22
+  (1.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
23
+  (0.2ms) SELECT version FROM "schema_migrations"
24
+  (2.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20140415060518')
25
+  (1.0ms) CREATE TABLE "paginative_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "latitude" float, "longitude" float, "created_at" datetime, "updated_at" datetime) 
26
+  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
27
+  (0.4ms) select sqlite_version(*)
28
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
29
+  (0.1ms) SELECT version FROM "schema_migrations"
30
+  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20140415060518')
31
+ ActiveRecord::SchemaMigration Load (1.9ms) SELECT "schema_migrations".* FROM "schema_migrations"
32
+ Migrating to AddAddressToTestModels (20140416020706)
33
+  (0.1ms) begin transaction
34
+  (0.2ms) ALTER TABLE "test_models" ADD "address" varchar(255)
35
+ SQLite3::SQLException: no such table: test_models: ALTER TABLE "test_models" ADD "address" varchar(255)
36
+  (0.1ms) rollback transaction
37
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
38
+ Migrating to AddAddressToTestModels (20140416020706)
39
+  (0.1ms) begin transaction
40
+  (3.0ms) ALTER TABLE "paginative_test_models" ADD "address" varchar(255)
41
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140416020706"]]
42
+  (0.5ms) commit transaction
43
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
44
+  (1.3ms) CREATE TABLE "paginative_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "latitude" float, "longitude" float, "created_at" datetime, "updated_at" datetime, "address" varchar(255)) 
45
+  (1.1ms) CREATE TABLE "paginative_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "latitude" float, "longitude" float, "created_at" datetime, "updated_at" datetime, "address" varchar(255)) 
46
+  (0.7ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
47
+  (0.3ms) select sqlite_version(*)
48
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
49
+  (0.1ms) SELECT version FROM "schema_migrations"
50
+  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20140416020706')
51
+  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20140415060518')
52
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
53
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
54
+  (0.9ms) CREATE TABLE "paginative_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "latitude" float, "longitude" float, "created_at" datetime, "updated_at" datetime, "address" varchar(255)) 
55
+  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
56
+  (0.1ms) select sqlite_version(*)
57
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
58
+  (0.1ms) SELECT version FROM "schema_migrations"
59
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140416020706')
60
+  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20140415060518')
61
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
62
+ Migrating to CreateTestModels (20140416035443)
63
+  (0.1ms) begin transaction
64
+  (1.0ms) CREATE TABLE "test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "address" varchar(255), "latitude" float, "longitude" float, "created_at" datetime, "updated_at" datetime) 
65
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140416035443"]]
66
+  (1.1ms) commit transaction
67
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
68
+  (1.2ms) CREATE TABLE "paginative_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "latitude" float, "longitude" float, "created_at" datetime, "updated_at" datetime, "address" varchar(255)) 
69
+  (0.9ms) CREATE TABLE "test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "address" varchar(255), "latitude" float, "longitude" float, "created_at" datetime, "updated_at" datetime)
70
+  (0.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
71
+  (0.1ms) select sqlite_version(*)
72
+  (0.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
73
+  (0.1ms) SELECT version FROM "schema_migrations"
74
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140416035443')
75
+  (1.6ms) CREATE TABLE "paginative_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "latitude" float, "longitude" float, "created_at" datetime, "updated_at" datetime, "address" varchar(255)) 
76
+  (0.9ms) CREATE TABLE "test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "address" varchar(255), "latitude" float, "longitude" float, "created_at" datetime, "updated_at" datetime)
77
+  (0.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
78
+  (0.1ms) select sqlite_version(*)
79
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
80
+  (0.1ms) SELECT version FROM "schema_migrations"
81
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140416035443')
82
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
83
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"