numeric_type_column 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. data/Rakefile +2 -0
  2. data/lib/numeric_type_column/active_record/{base_extension.rb → base_patch.rb} +3 -3
  3. data/lib/numeric_type_column/active_record/{belongs_to_polymorphic_association_extension.rb → belongs_to_polymorphic_association_patch.rb} +4 -4
  4. data/lib/numeric_type_column/active_record/{column_definition_extension.rb → column_definition_patch.rb} +4 -4
  5. data/lib/numeric_type_column/active_record/mysql_adapter_patch.rb +102 -0
  6. data/lib/numeric_type_column/active_record/schema_dumper_patch.rb +102 -0
  7. data/lib/numeric_type_column/active_record/{table_definition_extension.rb → table_definition_patch.rb} +3 -3
  8. data/lib/numeric_type_column/active_record.rb +8 -5
  9. data/lib/numeric_type_column/railtie.rb +11 -5
  10. data/lib/numeric_type_column/version.rb +1 -1
  11. data/test/dummy/README.rdoc +261 -0
  12. data/test/dummy/Rakefile +7 -0
  13. data/test/dummy/app/assets/javascripts/application.js +15 -0
  14. data/test/dummy/app/assets/javascripts/unsigned_columns_tests.js +2 -0
  15. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  16. data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
  17. data/test/dummy/app/assets/stylesheets/unsigned_columns_tests.css +4 -0
  18. data/test/dummy/app/controllers/application_controller.rb +3 -0
  19. data/test/dummy/app/controllers/unsigned_columns_tests_controller.rb +83 -0
  20. data/test/dummy/app/helpers/application_helper.rb +2 -0
  21. data/test/dummy/app/helpers/unsigned_columns_tests_helper.rb +2 -0
  22. data/test/dummy/app/models/unsigned_columns_test.rb +4 -0
  23. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  24. data/test/dummy/app/views/unsigned_columns_tests/_form.html.erb +37 -0
  25. data/test/dummy/app/views/unsigned_columns_tests/edit.html.erb +6 -0
  26. data/test/dummy/app/views/unsigned_columns_tests/index.html.erb +31 -0
  27. data/test/dummy/app/views/unsigned_columns_tests/new.html.erb +5 -0
  28. data/test/dummy/app/views/unsigned_columns_tests/show.html.erb +30 -0
  29. data/test/dummy/config/application.rb +59 -0
  30. data/test/dummy/config/boot.rb +10 -0
  31. data/test/dummy/config/database.yml +30 -0
  32. data/test/dummy/config/environment.rb +5 -0
  33. data/test/dummy/config/environments/development.rb +37 -0
  34. data/test/dummy/config/environments/mayhem.rb +37 -0
  35. data/test/dummy/config/environments/production.rb +67 -0
  36. data/test/dummy/config/environments/test.rb +37 -0
  37. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  38. data/test/dummy/config/initializers/inflections.rb +15 -0
  39. data/test/dummy/config/initializers/mime_types.rb +5 -0
  40. data/test/dummy/config/initializers/secret_token.rb +7 -0
  41. data/test/dummy/config/initializers/session_store.rb +8 -0
  42. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  43. data/test/dummy/config/locales/en.yml +5 -0
  44. data/test/dummy/config/routes.rb +60 -0
  45. data/test/dummy/config.ru +4 -0
  46. data/test/dummy/db/migrate/20121024034824_create_unsigned_columns_tests.rb +40 -0
  47. data/test/dummy/db/migrate/20121024090232_create_join_table_test.rb +19 -0
  48. data/test/dummy/db/schema.rb +38 -0
  49. data/test/dummy/db/seeds.rb +20 -0
  50. data/test/dummy/log/mayhem.log +1513 -0
  51. data/test/dummy/public/404.html +26 -0
  52. data/test/dummy/public/422.html +26 -0
  53. data/test/dummy/public/500.html +25 -0
  54. data/test/dummy/public/favicon.ico +0 -0
  55. data/test/dummy/script/rails +6 -0
  56. data/test/dummy/test/fixtures/unsigned_columns_tests.yml +15 -0
  57. data/test/dummy/test/functional/unsigned_columns_tests_controller_test.rb +49 -0
  58. data/test/dummy/test/unit/helpers/unsigned_columns_tests_helper_test.rb +4 -0
  59. data/test/dummy/test/unit/unsigned_columns_test_test.rb +7 -0
  60. data/test/numeric_type_column_test.rb +7 -0
  61. data/test/test_helper.rb +15 -0
  62. metadata +130 -10
  63. data/lib/numeric_type_column/active_record/abstract_mysql_adapter_extension.rb +0 -69
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,60 @@
1
+ Dummy::Application.routes.draw do
2
+ resources :unsigned_columns_tests
3
+
4
+ # The priority is based upon order of creation:
5
+ # first created -> highest priority.
6
+
7
+ # Sample of regular route:
8
+ # match 'products/:id' => 'catalog#view'
9
+ # Keep in mind you can assign values other than :controller and :action
10
+
11
+ # Sample of named route:
12
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
13
+ # This route can be invoked with purchase_url(:id => product.id)
14
+
15
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
16
+ # resources :products
17
+
18
+ # Sample resource route with options:
19
+ # resources :products do
20
+ # member do
21
+ # get 'short'
22
+ # post 'toggle'
23
+ # end
24
+ #
25
+ # collection do
26
+ # get 'sold'
27
+ # end
28
+ # end
29
+
30
+ # Sample resource route with sub-resources:
31
+ # resources :products do
32
+ # resources :comments, :sales
33
+ # resource :seller
34
+ # end
35
+
36
+ # Sample resource route with more complex sub-resources
37
+ # resources :products do
38
+ # resources :comments
39
+ # resources :sales do
40
+ # get 'recent', :on => :collection
41
+ # end
42
+ # end
43
+
44
+ # Sample resource route within a namespace:
45
+ # namespace :admin do
46
+ # # Directs /admin/products/* to Admin::ProductsController
47
+ # # (app/controllers/admin/products_controller.rb)
48
+ # resources :products
49
+ # end
50
+
51
+ # You can have the root of your site routed with "root"
52
+ # just remember to delete public/index.html.
53
+ # root :to => 'welcome#index'
54
+
55
+ # See how all your routes lay out with "rake routes"
56
+
57
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
58
+ # Note: This route will make all actions in every controller accessible via GET requests.
59
+ # match ':controller(/:action(/:id))(.:format)'
60
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,40 @@
1
+ class CreateUnsignedColumnsTests < ActiveRecord::Migration
2
+ def change
3
+ create_table :unsigned_columns_tests, :options => "COMMENT='Pruebas de unsigned columns.'" do |t|
4
+
5
+ t.integer :integer_unsigned_column,
6
+ :limit => 2,
7
+ :unsigned => true,
8
+ :comment => "Prueba con columna tipo Integer Unsigned."
9
+
10
+ t.integer :integer_signed_column,
11
+ :limit => 2,
12
+ :comment => "Prueba con columna tipo Integer."
13
+
14
+ t.string :string_column,
15
+ :limit => 24,
16
+ :comment => "Prueba con columna tipo String."
17
+
18
+ t.decimal :decimal_unsigned_column,
19
+ :precision => 4,
20
+ :scale => 2,
21
+ :unsigned => true,
22
+ :comment => "Prueba con columna tipo Decimal Unsigned."
23
+
24
+ t.float :unsigned_float_column,
25
+ :unsigned => true,
26
+ :comment => "Prueba con columna tipo Float Unsigned."
27
+
28
+ t.boolean :boolean_unsigned_column,
29
+ :unsigned => true,
30
+ :comment => "Prueba con columna tipo Boolean Unsigned."
31
+
32
+ t.references :references_unsigned_column,
33
+ :unsigned => true,
34
+ :comment => "Prueba con columna tipo References Unsigned."
35
+
36
+ t.timestamps
37
+ end
38
+ add_index :unsigned_columns_tests, [:references_unsigned_column_id], :name => :FK_unsigned_references_column_test
39
+ end
40
+ end
@@ -0,0 +1,19 @@
1
+ class CreateJoinTableTest < ActiveRecord::Migration
2
+ def change
3
+ create_table :join_table_tests, :id => false, :options => "COMMENT='Pruebas de join_table (:id => false).'" do |t|
4
+
5
+ t.references :object_a,
6
+ :limit => 2,
7
+ :unsigned => true,
8
+ :comment => "Prueba con columna tipo References Unsigned (A)."
9
+
10
+ t.references :object_b,
11
+ :limit => 2,
12
+ :unsigned => true,
13
+ :comment => "Prueba con columna tipo References Unsigned (B)."
14
+
15
+ end
16
+ add_index :join_table_tests, [:object_a_id], :name => :FK_join_table_test_a
17
+ add_index :join_table_tests, [:object_b_id], :name => :FK_join_table_test_b
18
+ end
19
+ end
@@ -0,0 +1,38 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20121024090232) do
15
+
16
+ create_table "join_table_tests", :id => false, :force => true, :options =>"ENGINE=InnoDB COLLATE=utf8_unicode_ci COMMENT='Pruebas de join_table (:id => false).'" do |t|
17
+ t.integer "object_a_id", :limit => 2, :unsigned => true, :comment => "Prueba con columna tipo References Unsigned (A)."
18
+ t.integer "object_b_id", :limit => 2, :unsigned => true, :comment => "Prueba con columna tipo References Unsigned (B)."
19
+ end
20
+
21
+ add_index "join_table_tests", ["object_a_id"], :name => "FK_join_table_test_a"
22
+ add_index "join_table_tests", ["object_b_id"], :name => "FK_join_table_test_b"
23
+
24
+ create_table "unsigned_columns_tests", :force => true, :options =>"ENGINE=InnoDB COLLATE=utf8_unicode_ci COMMENT='Pruebas de unsigned columns.'" do |t|
25
+ t.integer "integer_unsigned_column", :limit => 2, :unsigned => true, :comment => "Prueba con columna tipo Integer Unsigned."
26
+ t.integer "integer_signed_column", :limit => 2, :comment => "Prueba con columna tipo Integer."
27
+ t.string "string_column", :limit => 24, :comment => "Prueba con columna tipo String."
28
+ t.decimal "decimal_unsigned_column", :unsigned => true, :precision => 4, :scale => 2, :comment => "Prueba con columna tipo Decimal Unsigned."
29
+ t.float "unsigned_float_column", :unsigned => true, :comment => "Prueba con columna tipo Float Unsigned."
30
+ t.boolean "boolean_unsigned_column", :unsigned => true, :comment => "Prueba con columna tipo Boolean Unsigned."
31
+ t.integer "references_unsigned_column_id", :unsigned => true, :comment => "Prueba con columna tipo References Unsigned."
32
+ t.datetime "created_at", :null => false
33
+ t.datetime "updated_at", :null => false
34
+ end
35
+
36
+ add_index "unsigned_columns_tests", ["references_unsigned_column_id"], :name => "FK_unsigned_references_column_test"
37
+
38
+ end
@@ -0,0 +1,20 @@
1
+ [
2
+ {
3
+ :integer_unsigned_column => 1,
4
+ :integer_signed_column => -1,
5
+ :string_column => "Prueba 1",
6
+ :decimal_unsigned_column => 66.669,
7
+ :unsigned_float_column => 33.334,
8
+ :boolean_unsigned_column => false,
9
+ :references_unsigned_column_id => 23
10
+ },
11
+ {
12
+ :integer_unsigned_column => -1,
13
+ :integer_signed_column => -1,
14
+ :string_column => "Prueba 2",
15
+ :decimal_unsigned_column => -66.669,
16
+ :unsigned_float_column => -33.334,
17
+ :boolean_unsigned_column => false,
18
+ :references_unsigned_column_id => -23
19
+ }
20
+ ].each { |attrs| UnsignedColumnsTest.where(attrs).first_or_create }