sweet_actions 0.1.4 → 0.1.5

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: 3904d237f789cd3db0a4dc78e4f9adecc8bf3b9a
4
- data.tar.gz: 4231ace1119c75b32e0c57dd8f7ac33e1e02051a
3
+ metadata.gz: 1d876fa0a38c4362063893f5f103368cb66a0ef1
4
+ data.tar.gz: 76d1bcd450c832d38e708c34892ed17615efb569
5
5
  SHA512:
6
- metadata.gz: abc3087589ceed04b51f4e60b7fcb2485c4f96049bc7c029d3b9feaca16f1449d7518c328631f9c4a3dc8420d78c84f8701d48085e4361ccbfaa991450ff54af
7
- data.tar.gz: 57c3d381618502950e5e1301ede3de0d048890cb86a18280924632f661d9dd504c5ae50e7381918363cb76bb170747f79267e21f0c7f43ab202c796f46d361aa
6
+ metadata.gz: 549ae05b48cc2d281525898bfeaaa557a57399b41be1b42f6b944d29e948a2fdff43a1c1f32360740abbc112cc0ba05e0522433e52140cdba9c543b1b48fab59
7
+ data.tar.gz: 70ef12a7a56ea0b1a9651cfa9e67f54984cfe35a12f86c6d9a7de1768f51b31ee7900c69f512f4ad8d1a1b3ce6a85643cf95fcc500be79becc18c644ed27f47a
data/PITCHME.md CHANGED
@@ -186,6 +186,7 @@ end
186
186
  2. Generate resource (model, decanter, serializer, actions)
187
187
  3. Add routes
188
188
 
189
+ Note: you may want to disable protect_from_forgery
189
190
  ---
190
191
 
191
192
  ## 1. Install Gem
@@ -200,6 +201,7 @@ Terminal:
200
201
 
201
202
  ```
202
203
  bundle
204
+ bundle exec rails g sweet_actions:install
203
205
  ```
204
206
 
205
207
  ---
@@ -207,9 +209,10 @@ bundle
207
209
  ## 2. Generate Resource
208
210
 
209
211
  ```
210
- rails g model Event title:name start_date:date
211
- rails g decanter Event title:name start_date:date
212
- rails g serializer Event title:name start_date:date
212
+ rails g model Event name:string start_date:date
213
+ bundle exec rake db:migrate
214
+ rails g decanter Event name:string start_date:date
215
+ rails g serializer Event name:string start_date:date
213
216
  rails g actions Events
214
217
  ```
215
218
 
data/README.md CHANGED
@@ -243,10 +243,14 @@ end
243
243
 
244
244
  ## Installation
245
245
 
246
+ ### 1. Install Gem
247
+
246
248
  Gemfile:
247
249
 
248
- ```
250
+ ```ruby
249
251
  gem 'sweet_actions'
252
+ gem 'active_model_serializers'
253
+ gem 'decanter'
250
254
  ```
251
255
 
252
256
  Terminal:
@@ -254,4 +258,22 @@ Terminal:
254
258
  ```
255
259
  bundle
256
260
  bundle exec rails g sweet_actions:install
261
+ ```
262
+
263
+ ### 2. Generate Resource
264
+
265
+ ```
266
+ rails g model Event title:name start_date:date
267
+ bundle exec rake db:migrate
268
+ rails g decanter Event title:name start_date:date
269
+ rails g serializer Event title:name start_date:date
270
+ rails g actions Events
271
+ ```
272
+
273
+ ### 3. Add Routes
274
+
275
+ ```ruby
276
+ Rails.application.routes.draw do
277
+ create_sweet_actions(:events)
278
+ end
257
279
  ```
@@ -7,4 +7,9 @@ class UpdateAction < SweetActions::UpdateAction
7
7
  # can?(:update, resource)
8
8
  false
9
9
  end
10
+
11
+ def save
12
+ resource.attributes = resource_params
13
+ resource.save
14
+ end
10
15
  end
@@ -2,5 +2,9 @@ module SweetActions
2
2
  class CreateAction < ApiAction
3
3
  include RestConcerns
4
4
  include SaveConcerns
5
+
6
+ def save
7
+ resource.save
8
+ end
5
9
  end
6
10
  end
@@ -2,5 +2,10 @@ module SweetActions
2
2
  class UpdateAction < ApiAction
3
3
  include RestConcerns
4
4
  include SaveConcerns
5
+
6
+ def save
7
+ resource.attributes = resource_params
8
+ resource.save
9
+ end
5
10
  end
6
11
  end
@@ -1,3 +1,3 @@
1
1
  module SweetActions
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sweet_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Francis