polyblock 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/polyblock/polyblocks_controller.rb +12 -6
- data/lib/polyblock/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd1265ea7c1e6b44fe3eff02f5d97b65a72eb623
|
4
|
+
data.tar.gz: 5080b1d2528677ec91e26de8fb785459703454ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc0a82aca881525f1e5248addc80bb311706cdac72c4130a13131b4fceff5fe627dd7f3399a9b2fb7a5f1bc252e3172e3f95a47aefb05ded1b534a449cd7c85c
|
7
|
+
data.tar.gz: b98a0db71f5d2783d09bbe8db63aa3cf476f006286f6381d4d928f8017d9e7781af6ca2e1cccf0f1ef97743db93c5215646117c08511a1121382e8b83c353420
|
@@ -4,14 +4,20 @@ module Polyblock
|
|
4
4
|
class PolyblocksController < ApplicationController
|
5
5
|
|
6
6
|
def update
|
7
|
-
if params.key?(:pbs)
|
7
|
+
if params.key?(:pbs)
|
8
8
|
params[:pbs].each do |i, attrs|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
permitted_attrs = attrs.permit(:id, :name, :content, :_destroy)
|
10
|
+
id = permitted_attrs.delete :id
|
11
|
+
name = permitted_attrs[:name]
|
12
|
+
matching_block = if id.present?
|
13
|
+
Block.find id.to_i
|
14
|
+
elsif name.present?
|
15
|
+
Block.find_by :name => name
|
16
|
+
end
|
17
|
+
if matching_block.present?
|
18
|
+
matching_block.update_attributes!(permitted_attrs)
|
13
19
|
else
|
14
|
-
Block.create!
|
20
|
+
Block.create! permitted_attrs
|
15
21
|
end
|
16
22
|
end
|
17
23
|
render :text => "OK!"
|
data/lib/polyblock/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyblock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MacKinley Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|