rack-backend-api 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -299,6 +299,7 @@ CHANGE LOG
299
299
  0.2.2 Backend form should accept a block for populating the fields
300
300
  0.2.3 Send a 404 if the entry does not exist
301
301
  0.3.0 Implement cloning functionality
302
+ 0.3.2 IDs are turned into integers only on the adapter side, not in the middleware
302
303
 
303
304
  COPYRIGHT
304
305
  =========
data/lib/backend_api.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class BackendAPI
2
- VERSION = [0,3,1]
2
+ VERSION = [0,3,2]
3
3
  WRAP = <<-EOT
4
4
  <!doctype html>
5
5
  <html>
@@ -82,8 +82,8 @@ class BackendAPI
82
82
  @model_class_name = camel_case(@model_name)
83
83
  if !@model_name.nil? && ::Object.const_defined?(@model_class_name)
84
84
  @model_class = Kernel.const_get(@model_class_name)
85
- @model_instance = @model_class.backend_get(@id.to_i) unless @id.nil?
86
- @clone_instance = @model_class.backend_get(@req['clone_id'].to_i) unless @req['clone_id'].nil?
85
+ @model_instance = @model_class.backend_get(@id) unless @id.nil?
86
+ @clone_instance = @model_class.backend_get(@req['clone_id']) unless @req['clone_id'].nil?
87
87
  unless @clone_instance.nil?
88
88
  @req['fields'] ||= @clone_instance.cloning_backend_columns.map{|k|k.to_s}
89
89
  @req['model'] = @clone_instance.backend_values.select{|k,v| @req['fields'].include?(k.to_s)}
@@ -1,6 +1,7 @@
1
1
  module ::Sequel::Plugins::RackBackendApiAdapter
2
2
 
3
3
  module ClassMethods
4
+ def backend_get(id); self[id.to_i]; end
4
5
  def sort(list)
5
6
  list.each_with_index do |id, position|
6
7
  self[id].update(position_field=>position)
@@ -13,7 +14,6 @@ module ::Sequel::Plugins::RackBackendApiAdapter
13
14
  def self.included(model_class)
14
15
  model_class.class_eval do
15
16
  class << self
16
- alias backend_get []
17
17
  alias backend_post new
18
18
  end
19
19
  alias backend_delete destroy
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'rack-backend-api'
3
- s.version = "0.3.1"
3
+ s.version = "0.3.2"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = "A Rack middleware that provides a simple API for your Admin section"
6
6
  s.description = "The purpose of this Rack Middleware is to provide an API that interfaces with database actions in order to build a CMS."
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-backend-api
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
5
- prerelease: false
4
+ hash: 23
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mickael Riga
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-11 00:00:00 +01:00
19
- default_executable:
18
+ date: 2012-01-19 00:00:00 Z
20
19
  dependencies: []
21
20
 
22
21
  description: The purpose of this Rack Middleware is to provide an API that interfaces with database actions in order to build a CMS.
@@ -38,7 +37,6 @@ files:
38
37
  - test/db.rb
39
38
  - test/spec_backend_api.rb
40
39
  - test/spec_sequel_adapter.rb
41
- has_rdoc: true
42
40
  homepage: http://github.com/mig-hub/backend-api
43
41
  licenses: []
44
42
 
@@ -68,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
66
  requirements: []
69
67
 
70
68
  rubyforge_project:
71
- rubygems_version: 1.3.7
69
+ rubygems_version: 1.8.15
72
70
  signing_key:
73
71
  specification_version: 3
74
72
  summary: A Rack middleware that provides a simple API for your Admin section