ahc 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/ahc.gemspec +2 -2
  4. data/lib/ahc_helper.rb +13 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e923425602bb268c5c29762bcd8dbfd734afa4c
4
- data.tar.gz: c069570ce1759e53d6cc7caaf44375f463b760f8
3
+ metadata.gz: f1e615cd4bc83ae89c7a962979e2164877fd9123
4
+ data.tar.gz: 1956e0abdd72e403d26af83d5a52a155c7626b2e
5
5
  SHA512:
6
- metadata.gz: 429caba6da471556582560e4b5c86a5ac74f9b5fbea109c7df37a501f16624cc52d105c8cd69c5a09c7f56415f62982b89b0f237077116bc48f0d5e07984879f
7
- data.tar.gz: d41364b6b189d13823f7e1ed553ce02238effcd1bd304a8b36a57d59c81e0ae919eed8aabcae94005f65fc3a8047a1fb0eb131a79ba3b74bcdc3966a55424116
6
+ metadata.gz: fc25b31f5bf2a7e6e7603e2c223c017b1d6e837500d55a9fa02c5f1033d68c83b03ec72dc02fc5ea97ba94ad337ce3d282dcf25e35e0736293a834b5f1fb29a0
7
+ data.tar.gz: 36e2447e6256445821700ce0779980d7a5bd6589c2707083683d7216ee3052661bb9feecc68a17cf0153209f711a4a078e19aefc21b54e992814e1f0e329b896
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
data/ahc.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ahc"
8
- s.version = "0.3.2"
8
+ s.version = "0.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andriy Romanov"]
12
- s.date = "2013-12-12"
12
+ s.date = "2013-12-15"
13
13
  s.description = "Ahc allows you to move all your client side code to ahc server"
14
14
  s.email = "judo.ras@gmail.com"
15
15
  s.extra_rdoc_files = [
data/lib/ahc_helper.rb CHANGED
@@ -24,7 +24,19 @@ module AhcInheritedResourcesHelper
24
24
  controller = params[:controller].split('/').last
25
25
  action = params[:action]
26
26
  @data ||= {}
27
- @data['resources'] = collection
27
+ case params[:action]
28
+ when 'show'
29
+ @data['resource'] = resource
30
+ when 'index'
31
+ @data['resources'] = resources
32
+ when 'create', 'update'
33
+ params[:format] = 'json'
34
+ if resource.valid?
35
+ @data['resource'] = resource
36
+ else
37
+ @data['errors'] = resource.errors
38
+ end
39
+ end
28
40
  render_ahc("#{controller}/#{action}")
29
41
  end
30
42
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ahc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andriy Romanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-12 00:00:00.000000000 Z
11
+ date: 2013-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec