rest_in_place 2.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -25,7 +25,7 @@ updated record in the response to the PUT request. See the testapp for an
25
25
  example.
26
26
 
27
27
  URL: <http://github.com/janv/rest_in_place/>
28
- REPOSITORY: git://github.com/janv/rest_in_place.git
28
+ REPOSITORY: git://github.com/janv/rest_in_place.git
29
29
  BLOG: <http://jan.varwig.org/projects/rest-in-place>
30
30
 
31
31
  If you like REST in Place, you can flattr me: <a href="http://flattr.com/thing/1984/REST-in-Place" target="_blank">
@@ -84,7 +84,7 @@ JavaScript files in `app/assets`, for example in your application.js:
84
84
 
85
85
  In both cases, make sure you load REST in Place __after__ jQuery.
86
86
 
87
- Rails Request forgery Protection
87
+ Rails Request Forgery Protection
88
88
  ================================
89
89
 
90
90
  For REST in Place to work with Rails request forgery protection, you need to
@@ -131,7 +131,7 @@ follows:
131
131
  from them, so that (with the current documents url used) you really only need
132
132
  to provide the attributes name in most cases.
133
133
 
134
- **Note that a manually defined (in the element or in one of the parents)
134
+ **Note that a manually defined (in the element or in one of the parents)
135
135
  object always overrides dom_id recognition.**
136
136
 
137
137
  - REST in Place supports multiple form types. The default type is a input
@@ -234,4 +234,4 @@ tests pass.
234
234
 
235
235
 
236
236
  ---
237
- Copyright (c) 2011 [Jan Varwig], released under the MIT license
237
+ Copyright (c) 2012 [Jan Varwig], released under the MIT license
@@ -193,7 +193,7 @@ RestInPlaceEditor.forms =
193
193
  $ = jQuery
194
194
 
195
195
  # Detect Rails Settings
196
- RestInPlaceEditor.prototype.include_root_in_json = "<%= ActiveRecord::Base.include_root_in_json %>" == "true"
196
+ RestInPlaceEditor.prototype.include_root_in_json = "<%= RestInPlace.include_root_in_json? %>" == "true"
197
197
 
198
198
  # Install in global namespace
199
199
  window.RestInPlaceEditor = RestInPlaceEditor
data/lib/rest_in_place.rb CHANGED
@@ -4,4 +4,14 @@ module RestInPlace
4
4
  class Engine < Rails::Engine
5
5
  # no ruby code here!
6
6
  end
7
+
8
+ def self.include_root_in_json?
9
+ if defined?(Mongoid)
10
+ Mongoid.config.include_root_in_json
11
+ elsif defined?(ActiveRecord)
12
+ ActiveRecord::Base.include_root_in_json
13
+ else
14
+ false
15
+ end
16
+ end
7
17
  end
@@ -1,3 +1,3 @@
1
1
  module RestInPlace
2
- VERSION = "2.0"
2
+ VERSION = "2.0.1"
3
3
  end
@@ -5,7 +5,7 @@ require "rest_in_place/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "rest_in_place"
7
7
  s.version = RestInPlace::VERSION
8
- s.date = '2011-12-03'
8
+ s.date = '2012-04-03'
9
9
  s.authors = ["Jan Varwig"]
10
10
  s.email = ["jan@varwig.org"]
11
11
  s.homepage = "http://jan.varwig.org"
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest_in_place
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- version: "2.0"
9
+ - 1
10
+ version: 2.0.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Jan Varwig
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-12-03 00:00:00 Z
18
+ date: 2012-04-03 00:00:00 Z
18
19
  dependencies:
19
20
  - !ruby/object:Gem::Dependency
20
21
  name: rails