-
Notifications
You must be signed in to change notification settings - Fork 67
Sql #104
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
base: sql
Are you sure you want to change the base?
Sql #104
Changes from all commits
8fc7100
5b643de
b0092bb
58fcebe
a9ef57e
f395e2a
7e9b077
050c45c
da0cd6e
97581ac
213317d
19e5132
e182136
3eeb216
7dd370a
ea6a969
1d497b9
230c5d9
a719c9a
4c10aaa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,8 @@ | ||
| source "https://rubygems.org" | ||
| source 'https://rubygems.org' | ||
|
|
||
| gem "rake" | ||
| gem "bubble-wrap" | ||
| gem "motion-stump", '~>0.2' | ||
| gem 'rake' | ||
| gem 'motion-support' | ||
| gem 'motion-cocoapods' | ||
| gem 'bubble-wrap' | ||
| gem 'motion-stump' | ||
|
|
||
| gem "motion-support", ">= 0.2.2" | ||
|
|
||
| gem 'cocoapods', '~>0.19.1' | ||
| gem 'motion-cocoapods', '~>1.3.0' | ||
|
|
||
| gemspec |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,75 +1,56 @@ | ||
| PATH | ||
| remote: . | ||
| specs: | ||
| motion_model (0.4.6) | ||
| bubble-wrap (= 1.3.0) | ||
| motion-support (>= 0.2.2) | ||
|
|
||
| GEM | ||
| remote: https://rubygems.org/ | ||
| specs: | ||
| activesupport (3.2.13) | ||
| i18n (= 0.6.1) | ||
| activesupport (3.2.16) | ||
| i18n (~> 0.6, >= 0.6.4) | ||
| multi_json (~> 1.0) | ||
| addressable (2.3.4) | ||
| bubble-wrap (1.3.0) | ||
| claide (0.2.0) | ||
| cocoapods (0.19.1) | ||
| activesupport (~> 3.2.13) | ||
| claide (~> 0.2.0) | ||
| cocoapods-core (= 0.19.1) | ||
| cocoapods-downloader (~> 0.1.0) | ||
| bubble-wrap (1.4.0) | ||
| claide (0.4.0) | ||
| cocoapods (0.29.0) | ||
| activesupport (>= 3.2.15, < 4) | ||
| claide (~> 0.4.0) | ||
| cocoapods-core (= 0.29.0) | ||
| cocoapods-downloader (~> 0.3.0) | ||
| cocoapods-try-release-fix (~> 0.1.1) | ||
| colored (~> 1.2) | ||
| escape (~> 0.0.4) | ||
| faraday (~> 0.8.1) | ||
| json (~> 1.7.3) | ||
| octokit (~> 1.7) | ||
| open4 (~> 1.3.0) | ||
| rake (~> 10.0.0) | ||
| xcodeproj (~> 0.5.5) | ||
| cocoapods-core (0.19.1) | ||
| activesupport (~> 3.2.13) | ||
| rake (~> 10.0.0) | ||
| cocoapods-downloader (0.1.0) | ||
| json_pure (~> 1.8) | ||
| nap (~> 0.5) | ||
| open4 (~> 1.3) | ||
| xcodeproj (~> 0.14.1) | ||
| cocoapods-core (0.29.0) | ||
| activesupport (>= 3.2.15, < 4) | ||
| fuzzy_match (~> 2.0.4) | ||
| json_pure (~> 1.8) | ||
| nap (~> 0.5) | ||
| cocoapods-downloader (0.3.0) | ||
| cocoapods-try-release-fix (0.1.1) | ||
| colored (1.2) | ||
| escape (0.0.4) | ||
| faraday (0.8.7) | ||
| multipart-post (~> 1.1) | ||
| faraday_middleware (0.9.0) | ||
| faraday (>= 0.7.4, < 0.9) | ||
| hashie (2.0.5) | ||
| i18n (0.6.1) | ||
| json (1.7.7) | ||
| motion-cocoapods (1.3.1) | ||
| cocoapods (>= 0.17.0) | ||
| motion-require (0.0.6) | ||
| motion-stump (0.2.1) | ||
| motion-support (0.2.2) | ||
| fuzzy_match (2.0.4) | ||
| i18n (0.6.9) | ||
| json_pure (1.8.1) | ||
| motion-cocoapods (1.4.0) | ||
| cocoapods (>= 0.26.2) | ||
| motion-require (0.1.0) | ||
| motion-stump (0.3.1) | ||
| motion-support (0.2.6) | ||
| motion-require (>= 0.0.6) | ||
| multi_json (1.7.3) | ||
| multipart-post (1.2.0) | ||
| netrc (0.7.7) | ||
| octokit (1.24.0) | ||
| addressable (~> 2.2) | ||
| faraday (~> 0.8) | ||
| faraday_middleware (~> 0.9) | ||
| hashie (~> 2.0) | ||
| multi_json (~> 1.3) | ||
| netrc (~> 0.7.7) | ||
| multi_json (1.8.4) | ||
| nap (0.6.0) | ||
| open4 (1.3.0) | ||
| rake (10.0.4) | ||
| xcodeproj (0.5.5) | ||
| activesupport (~> 3.2.13) | ||
| rake (10.1.1) | ||
| xcodeproj (0.14.1) | ||
| activesupport (~> 3.0) | ||
| colored (~> 1.2) | ||
| rake | ||
|
|
||
| PLATFORMS | ||
| ruby | ||
|
|
||
| DEPENDENCIES | ||
| bubble-wrap | ||
| cocoapods (~> 0.19.1) | ||
| motion-cocoapods (~> 1.3.0) | ||
| motion-stump (~> 0.2) | ||
| motion-support (>= 0.2.2) | ||
| motion_model! | ||
| motion-cocoapods | ||
| motion-stump | ||
| motion-support | ||
| rake |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,25 @@ | ||
| # -*- coding: utf-8 -*- | ||
| require "bundler/gem_tasks" | ||
| $:.unshift("/Library/RubyMotion/lib") | ||
| require 'motion/project/template/ios' | ||
| require 'bundler' | ||
| Bundler.require(:default) | ||
|
|
||
| begin | ||
| require 'bundler' | ||
| Bundler.require | ||
| rescue LoadError | ||
| end | ||
|
|
||
| require 'motion-cocoapods' | ||
|
|
||
| $: << File.expand_path('/lib', __FILE__) | ||
|
|
||
| require 'motion_model' | ||
| require 'motion_model/array' | ||
| require 'motion_model/sql' | ||
| require 'motion_model/fmdb' | ||
|
|
||
| Motion::Project::App.setup do |app| | ||
| # Use `rake config' to see complete project settings. | ||
| app.name = 'MotionModel' | ||
| app.delegate_class = 'FakeDelegate' | ||
|
|
||
| app.pods do | ||
| pod 'FMDB', '2.0' | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,3 @@ | ||
| require 'motion-require' | ||
| require 'motion-support' | ||
|
|
||
| %w(*.rb model/*.rb adapters/*.rb).each do |path| | ||
| %w[*.rb model/*.rb adapters/*.rb adapters/array/*.rb adapters/sql/sql_db_adapter.rb adapters/sql/sqlite3_adapter.rb adapters/sql/*.rb].each do |path| | ||
| Motion::Require.all(Dir.glob(File.expand_path("../../motion/#{path}", __FILE__))) | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -533,9 +533,12 @@ def save_without_transaction(options = {}) | |
| end | ||
|
|
||
| # Set created_at and updated_at fields | ||
|
|
||
| def set_auto_date_field(field_name) | ||
| method = "#{field_name}=" | ||
| self.send(method, Time.now) if self.respond_to?(method) | ||
| if self.respond_to?(method) | ||
| self.send(method, Time.now) if self.send(field_name).blank? | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't this break setting #updated_at on existing records?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right. I missed this bug because I`m manually setting updated_at on my updater. |
||
| end | ||
| end | ||
|
|
||
| def hooks(name) | ||
|
|
@@ -817,7 +820,8 @@ def unload_relation(col) | |
| end | ||
|
|
||
| def initialize_data_columns(column, value) #nodoc | ||
| self.attributes = {column => value || self.class.default(column)} | ||
| _value = value.nil? ? self.class.default(column) : value | ||
| self.attributes = {column => _value} | ||
| end | ||
|
|
||
| def column_as(col) #nodoc | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is TrueClass#to_i an RM extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is. Before this fix "where(current: true)" was being translated to WHERE ("users"."current" = "true") and it should be WHERE ("users"."current" = 1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
value = @valuework?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is working here. Maibe caling @value.dup it would be more appropriate. I`m not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For true/false I assume the boolean should be passed through, if FMDB handles booleans directly which I would assume it does. No dup necessary:
a = true; b = a; b = false; a # => true