rails-extjs-direct 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,14 +32,11 @@ module Rails::ExtJS::Direct::Controller
32
32
 
33
33
  params["authenticity_token"] = token if token
34
34
 
35
- params[:id] = @xrequest.id
36
-
37
- if @xrequest.id.kind_of?(Array)
38
- params[:data] = @xrequest.params
35
+ if @xrequest.params.kind_of?(Integer) || @xrequest.params.kind_of?(Array)
36
+ params[:id] = @xrequest.params
39
37
  elsif @xrequest.params.kind_of?(Hash)
40
- params[:data] = {}
41
38
  @xrequest.params.each do |k,v|
42
- params[:data][k] = v
39
+ params[k] = v
43
40
  end
44
41
  end
45
42
  end
@@ -8,24 +8,11 @@ class XRequest
8
8
 
9
9
  def initialize(params)
10
10
  # TODO: simply setting @id, @params
11
- @id = (params["id"].to_i > 0) ? params["id"].to_i : (params["data"].kind_of?(Array) && (params["data"].first.kind_of?(Integer) || params["data"].first.nil?)) ? params["data"].shift : nil
12
11
  @tid = params["tid"]
13
12
  @type = params["type"]
14
- @params = (params["data"].kind_of?(Array) && params["data"].length == 1 && params["data"].first.kind_of?(Hash)) ? params["data"].first : params["data"] || []
13
+ @params = (params["data"].kind_of?(Array)) ? params["data"].first : {}
15
14
  @controller = params["xcontroller"]
16
15
  @action = params["xaction"]
17
16
  end
18
17
 
19
- ##
20
- # arg
21
- # return a request argument at index. can be used to access either [] or {}
22
- # @param {String/Integer} index
23
- # @raises XException if params doesn't exist.
24
- #
25
- def arg(index)
26
- if params[index].nil?
27
- raise XException.new("Attempt to access unknown request argument '#{index.to_s}' on transaction #{@tid}")
28
- end
29
- @params[index]
30
- end
31
18
  end
@@ -4,7 +4,7 @@
4
4
  module Rails
5
5
  module ExtJS
6
6
  module Direct
7
- VERSION = '0.0.14'
7
+ VERSION = '0.0.15'
8
8
  end
9
9
  end
10
10
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rails-extjs-direct}
5
- s.version = "0.0.14"
5
+ s.version = "0.0.15"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Chris Scott"]
9
- s.date = %q{2009-09-27}
9
+ s.date = %q{2009-09-29}
10
10
  s.description = %q{A series of components for implementing the Ext.Direct API specification in Rails 2.3 and higher.
11
11
  Ext.Direct in Rails is implementede with Rack Middleware.}
12
12
  s.email = ["christocracy@gmail.com"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-extjs-direct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Scott
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-27 00:00:00 -04:00
12
+ date: 2009-09-29 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency