volt 0.9.5.pre2 → 0.9.5.pre3

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: a5ad03d3fbc695e769889222bdd6657b969c8f0c
4
- data.tar.gz: 71b3134705638ac491e1cdb37859aefafe44d159
3
+ metadata.gz: 552337e005627aa06bff5950bcd94cbb5ab58684
4
+ data.tar.gz: cf7e89e6862c51796186c9034a62e378e27abcfc
5
5
  SHA512:
6
- metadata.gz: 97fb9fafd89425cd8a137b9758ebb488a289af1f88b25b4b893693852138a6325e354863d4a737155191f386166af62b54d7e88799b3feef17e74f3f9ef5a9dc
7
- data.tar.gz: 8ea29521ba220cfdf866db220bca6e6afc62c2e4086fe4d72b10cbc3964ed7545974ba199ba03a0514c1c620515bc3e139b94506214b6910934dd5a6871823e6
6
+ metadata.gz: 9c42d896c2c9cb881778a8a90dee2c2ff398213540bbaa4183f13c748106b7f8d0724cf50327ce090e7e1c30dcb7336d758f4a5d5ec61521420b53a33478593d
7
+ data.tar.gz: ea0d96fa24038a6d45d99a3adb3ee59cd072adef219a48aa7c5543e63de9f52f7abf16fd6564aa4ed740e7cc137fcbd2c65220e38a76cf1e8ea7a664fb7ac868
data/README.md CHANGED
@@ -58,7 +58,3 @@ VoltFramework is currently a labor of love mainly built by a small group of core
58
58
  [![Pledgie](https://pledgie.com/campaigns/26731.png?skin_name=chrome)](https://pledgie.com/campaigns/26731)
59
59
 
60
60
  Bitcoins can also be sent to 1AYiL3MiSVe2QFyexzozUvFFH7uGCJgJMZ
61
-
62
-
63
- Timings:
64
- - view:
@@ -59,8 +59,6 @@ module Volt
59
59
 
60
60
  def initialize(array = [], options = {})
61
61
  @options = options
62
- @parent = options[:parent]
63
- @path = options[:path] || []
64
62
  @persistor = setup_persistor(options[:persistor])
65
63
 
66
64
  array = wrap_values(array)
@@ -74,6 +72,22 @@ module Volt
74
72
  end
75
73
  end
76
74
 
75
+ def parent=(val)
76
+ @options[:parent] = val
77
+ end
78
+
79
+ def parent
80
+ @options[:parent]
81
+ end
82
+
83
+ def path
84
+ @options[:path] || []
85
+ end
86
+
87
+ def path=(val)
88
+ @options[:path] = val
89
+ end
90
+
77
91
  def attributes
78
92
  self
79
93
  end
@@ -37,7 +37,16 @@ module Volt
37
37
 
38
38
  define_method(method_name) do
39
39
  lookup_key = get(local_key)
40
- get(collection).where(foreign_key => lookup_key)
40
+ array_model = root.get(collection).where(foreign_key => lookup_key)
41
+
42
+ # Since we are coming off of the root collection, we need to setup
43
+ # the right parent and path.
44
+ new_path = array_model.options[:path]
45
+ # Assign path and parent
46
+ array_model.path = self.path + new_path
47
+ array_model.parent = self
48
+
49
+ array_model
41
50
  end
42
51
  end
43
52
 
@@ -5,6 +5,7 @@ module FieldHelpers
5
5
  NUMERIC_CAST = lambda do |convert_method, val|
6
6
  begin
7
7
  orig = val
8
+
8
9
  val = send(convert_method, val)
9
10
 
10
11
  if RUBY_PLATFORM == 'opal'
@@ -134,7 +134,7 @@ module Volt
134
134
 
135
135
  parent.persistor.ensure_setup if parent.persistor
136
136
 
137
- if parent && (attrs = parent.attributes) && attrs[:id]
137
+ if parent && !@model.is_a?(Cursor) && (attrs = parent.attributes) && attrs[:id]
138
138
  query = query.dup
139
139
 
140
140
  query << [:find, { :"#{@model.path[-3].singularize}_id" => attrs[:id] }]
@@ -210,7 +210,7 @@ module Volt
210
210
  # Returns a promise that is resolved/rejected when the query is complete. Any
211
211
  # passed block will be passed to the promises then. Then will be passed the model.
212
212
  def fetch(&block)
213
- Volt.logger.warn('Deprication warning: in 0.9.3.pre4, all query methods on store now return Promises, so you can juse use .all or .first instead of .first')
213
+ Volt.logger.warn('Deprication warning: in 0.9.3.pre4, all query methods on store now return Promises, so you can juse use .all or .first instead of .fetch')
214
214
  promise = Promise.new
215
215
 
216
216
  # Run the block after resolve if a block is passed in
@@ -33,6 +33,7 @@ module Volt
33
33
  @model.attributes ||= {}
34
34
  @model.attributes[method_name] = model
35
35
  end
36
+
36
37
  model
37
38
  end
38
39
 
@@ -55,8 +55,8 @@ module Volt
55
55
 
56
56
  if Volt.config.compress_css
57
57
  # Use csso for css compression by default.
58
- require 'volt/utils/csso_patch'
59
58
  require 'csso'
59
+ require 'volt/utils/csso_patch'
60
60
  Csso.install(environment)
61
61
  end
62
62
 
@@ -19,6 +19,20 @@ module Csso
19
19
  def compress css, structural_optimization=true
20
20
  @csso.call("do_compression", css, !structural_optimization)
21
21
  end
22
+ end
23
+
22
24
 
25
+ # https://github.com/Vasfed/csso-rails/pull/23/files
26
+ def self.install(sprockets)
27
+ if sprockets.respond_to? :register_compressor
28
+ compressor = Compressor.new
29
+ sprockets.register_compressor('text/css', :csso, proc { |context, css|
30
+ compressor.compress(css)
31
+ })
32
+ sprockets.css_compressor = :csso
33
+ else
34
+ Sprockets::Compressors.register_css_compressor(:csso, 'Csso::Compressor', :default => true)
35
+ end
23
36
  end
37
+
24
38
  end
data/lib/volt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Volt
2
2
  module Version
3
- STRING = '0.9.5.pre2'
3
+ STRING = '0.9.5.pre3'
4
4
  end
5
5
  end
@@ -83,6 +83,8 @@ describe Volt::Associations do
83
83
 
84
84
  it 'should assign the reference_id for has_many' do
85
85
  bob = store.people.create.sync
86
+
87
+ expect(bob.path).to eq([:people, :[]])
86
88
  address = bob.addresses.create({:street => '1234 awesome street'})
87
89
 
88
90
  expect(bob.addresses[0].sync.person_id).to eq(bob.id)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: volt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5.pre2
4
+ version: 0.9.5.pre3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Stout
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-21 00:00:00.000000000 Z
11
+ date: 2015-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor