cyrax 0.5.0 → 0.5.1.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTlmMTE4OTYxZTNlOGJjZWE5ZmY0NjNjNjZlNDRkZDY0YmFkZDY0ZA==
4
+ ZjFlMDA4MTNmMmFhOWI0NjZlMDI5NTQ5NGU4OTU3ODA0ZWM4MmMxNg==
5
5
  data.tar.gz: !binary |-
6
- ODY3YmYxMWQ5NDY4NjAyNzRjYTdjM2Q4ZmFmZGU3YWQzODg1ZmRlZA==
6
+ ODVlNDdhM2I2ODk5NWI0MjlmYmYxOTBhYzc0ZGU5MTQyOGExNWRkNg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YzE5OGIzYzkxNGMzYTEzNmJjY2IxMWRiOTNlNWJiODdkOGFmZTYzYzFhZmQx
10
- YmZjNTVlOTk3MzBkOTE4NTJjNmZhNGE4NzRhZDhhNzdiMTNmNjcwNGU4ZGU4
11
- OWE3NmE3NmYxMTc3ZmNiMDhiOWZmZWZlZTNiZTI1NjE4NTk4Yjk=
9
+ MmM5ZmY0YTI5YmRkMWQ5MGNlZjkxM2JjM2RhNDhiZjg4YmU0MjEyMDZhZDYz
10
+ OWYxZjJjNTdmOGUwM2U2YzVkZGQ2N2NkY2JlZDQ2M2I0NmQzYTk4MDI3ODM5
11
+ MjcxMjYyZDgxZDE4ZTlmYWYwYTNlODJjMTYwOGJkMjM2Yjg3ZDM=
12
12
  data.tar.gz: !binary |-
13
- ZGQ1MDhkZmFhZDJiN2FjYTQ0OWM0MDRjYzUzMmI1ZmFiZjViMzRiNzUxMTA1
14
- OTYwNDI4NGJkYWNjMDQzMTYyZGRjODUxY2I0ZWYzMjcwYTVkZDk0YjBiN2I3
15
- ODI4ZmUxMzk2NTEzYzQ5Njc5ZGEzZDJlMzQwYmY1NmFmZDdlMTQ=
13
+ OGIzNjMyMDRjN2YzOTQ4MjYwODYzN2ZhZWU4NWE3MzM0Yjc3OWViNTdhNjRi
14
+ ZjE5ZjgyMDdiNDcwMmUwNTFhMDQzOWE1ZmY0MjEwOWU4Y2E0YmIxZDljM2Fi
15
+ N2U3YWE5Y2JjZGVjOWQyNGY2YjBkZGRiNjMyYWM4OWM4OTM5MmM=
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Cyrax [![Build Status](https://travis-ci.org/droidlabs/cyrax.png)](https://travis-ci.org/droidlabs/cyrax) [![Code Climate](https://codeclimate.com/github/droidlabs/cyrax.png)](https://codeclimate.com/github/droidlabs/cyrax)
1
+ # Cyrax [![Build Status](https://travis-ci.org/droidlabs/cyrax.png)](https://travis-ci.org/droidlabs/cyrax) [![Code Climate](https://codeclimate.com/github/droidlabs/cyrax.png)](https://codeclimate.com/github/droidlabs/cyrax) [![Roadchange](http://roadchange.com/droidlabs/cyrax/badge.png)](http://roadchange.com/droidlabs/cyrax)
2
2
  ![Cyrax](http://images2.wikia.nocookie.net/__cb20121118042055/mk/images/thumb/4/44/CyraxMK9Render.png/322px-CyraxMK9Render.png)
3
3
  > Safeties disabled; combat mode engaged.
4
4
 
@@ -1,5 +1,5 @@
1
1
  module Cyrax::ControllerHelper
2
- def respond_with(*args)
2
+ def respond_with(*args, &block)
3
3
  if args.present? && args.first.is_a?(Cyrax::Response)
4
4
  response, options = *args
5
5
  options = {
@@ -14,12 +14,18 @@ module Cyrax::ControllerHelper
14
14
  result = response.result
15
15
  result = result.to_model if result.respond_to?(:to_model)
16
16
 
17
- # set flashes
18
- flash[:notice] = options[:notice] if options[:notice].present?
19
- flash[:error] = options[:error] if options[:error].present?
20
- set_resource_from(response)
21
-
22
- super(result, options) do |format|
17
+ respond_to do |format|
18
+ format.html do
19
+ # set flashes
20
+ if response.success?
21
+ flash[:notice] = options[:notice] if options[:notice].present?
22
+ else
23
+ flash.now[:notice] = options[:notice] if options[:notice].present?
24
+ flash.now[:error] = options[:error] if options[:error].present?
25
+ end
26
+ set_resource_from(response)
27
+ super(result, options, &block)
28
+ end
23
29
  format.json do
24
30
  render json: response.as_json
25
31
  end
@@ -41,7 +41,9 @@ class Cyrax::Response
41
41
  end
42
42
 
43
43
  def error
44
- message || error_messages.first if failure?
44
+ if failure?
45
+ message || I18n.t("cyrax.errors.default", default: "There was appeared some errors.")
46
+ end
45
47
  end
46
48
 
47
49
  def has_error?(error)
data/lib/cyrax/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cyrax
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1.beta1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cyrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Droidlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-27 00:00:00.000000000 Z
11
+ date: 2013-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -132,9 +132,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - ! '>='
135
+ - - ! '>'
136
136
  - !ruby/object:Gem::Version
137
- version: '0'
137
+ version: 1.3.1
138
138
  requirements: []
139
139
  rubyforge_project:
140
140
  rubygems_version: 2.0.5