ember-rails 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b60a63f6567215c83896d987c2a2d6f23e2e36be
4
- data.tar.gz: 1d7a76412bb6a2aff43f2c1d113a6eb2b591f1ff
3
+ metadata.gz: 3d46472d346a709f8580fb4050457cc583d25c02
4
+ data.tar.gz: 584df87b5a4286f252d6358856d11893af17caa0
5
5
  SHA512:
6
- metadata.gz: 336a685840c73eb1ad6cd7ce70142e939ec39461930821725381c449e5b86e327bc5062b34c886d9bc7bfc769f9020aed1c634929e15367a8c0f4148d4773f7f
7
- data.tar.gz: daa683afc9cf7da1f1f0c9f659df026d466d5f65f108e0365b03cdd60c0965287dbeaf7fe247fb082f81e0d7e7bdfc81f378dd35f662d590dd75d47279e46880
6
+ metadata.gz: ff21e550943f708355597fcc7ef9bc51661b5680199e0c1cdfbb7c497bcd062210194f301795ee438ec95a8dc0c74b1ffd0c378f8a298a88974c358a4285d98e
7
+ data.tar.gz: 77c10beb5d970e42b94cd6138a0860835182d9e01334e10d07c20e40148229aa5e8b65d747026c8d09b8c248a8b4b0ce5e81dc9c34fd9268d262b18ea2cb8c19
data/README.md CHANGED
@@ -1,20 +1,20 @@
1
- # ember-rails [![Build Status](https://secure.travis-ci.org/emberjs/ember-rails.png?branch=master)](http://travis-ci.org/emberjs/ember-rails) [![Dependency Status](https://gemnasium.com/emberjs/ember-rails.png)](https://gemnasium.com/emberjs/ember-rails)
1
+ # ember-rails [![Build Status](https://secure.travis-ci.org/emberjs/ember-rails.svg?branch=master)](http://travis-ci.org/emberjs/ember-rails) [![Dependency Status](https://gemnasium.com/emberjs/ember-rails.png)](https://gemnasium.com/emberjs/ember-rails)
2
2
 
3
3
  ember-rails makes developing an [Ember.JS](http://emberjs.com/) application much easier in Rails 3.1+.
4
4
 
5
5
  The following functionalities are included in this gem:
6
6
  - Pre-compiling of your handlebars templates when building your asset pipeline.
7
- - Includes development and production copies of Ember, [Ember Data](https://github.com/emberjs/data) and [Handlebars](https://github.com/wycats/handlebars.js).
8
- - Includes [ActiveModel::Serializer](https://github.com/rails-api/active_model_serializers) for integration with Ember Data.
7
+ - Inclusion of development and production copies of Ember, [Ember Data](https://github.com/emberjs/data) and [Handlebars](https://github.com/wycats/handlebars.js).
8
+ - Inclusion of [ActiveModel::Serializer](https://github.com/rails-api/active_model_serializers) for integration with Ember Data.
9
9
 
10
- You can see an example of how to use the gem [here](https://github.com/keithpitt/ember-rails-example). There is also a great tutorial by [Dan Gebhardt](https://twitter.com/#!/dgeb) called "[Beginning Ember.js on Rails](http://www.cerebris.com/blog/2012/01/24/beginning-ember-js-on-rails-part-1/)" which is a great read if you're just starting out with Rails and Ember.js
10
+ You can see an example of how to use the gem [here](https://github.com/keithpitt/ember-rails-example). There is also a great tutorial by [Dan Gebhardt](https://twitter.com/#!/dgeb) called "[Beginning Ember.js on Rails](http://www.cerebris.com/blog/2012/01/24/beginning-ember-js-on-rails-part-1/)" which is a great read if you're just starting out with Rails and Ember.js.
11
11
 
12
12
  ## Getting started
13
13
  * Add the gem to your application Gemfile:
14
14
 
15
15
  ```ruby
16
16
  gem 'ember-rails'
17
- gem 'ember-source', '1.5.0' # or the version you need
17
+ gem 'ember-source', '~> 1.9.0' # or the version you need
18
18
  ```
19
19
 
20
20
  * Run `bundle install`
@@ -54,29 +54,28 @@ You'll probably need to clear out your cache after doing this with:
54
54
  rake tmp:clear
55
55
  ```
56
56
 
57
+ Also, ember-rails include some flags for the bootstrap generator:
58
+
59
+ ```
60
+ --ember-path or -d # custom ember path
61
+ --skip-git or -g # skip git keeps
62
+ --javascript-engine # engine for javascript (js, coffee or em)
63
+ --app-name or -n # custom ember app name
64
+ ```
65
+
66
+
57
67
  ## For CoffeeScript support
58
68
 
59
- 1. Add coffee-rails to the Gemfile
69
+ Add coffee-rails to the Gemfile
60
70
  ```ruby
61
71
  gem 'coffee-rails'
62
72
  ```
63
73
 
64
- 2. Run the bootstrap generator in step 4 with an extra flag instead:
74
+ Run the bootstrap generator in step 4 with an extra flag instead:
65
75
  ```sh
66
76
  rails g ember:bootstrap -g --javascript-engine coffee
67
77
  ```
68
78
 
69
- Note:
70
-
71
- Ember-rails include some flags options for bootstrap generator:
72
-
73
- ```
74
- --ember-path or -d # custom ember path
75
- --skip-git or -g # skip git keeps
76
- --javascript-engine # engine for javascript (js or coffee)
77
- --app-name or -n # custom ember app name
78
- ```
79
-
80
79
  ## For EmberScript support
81
80
 
82
81
  [EmberScript](http://www.emberscript.com) is a dialect of CoffeeScript
@@ -95,45 +94,87 @@ You can now use the flag `--javascript-engine=em` to specify EmberScript
95
94
  assets in your generators, but all of the generators will default to
96
95
  using an EmberScript variant first.
97
96
 
97
+ Note:
98
+
99
+ Ember-rails include some flags options for bootstrap generator:
100
+
101
+ ```
102
+ --ember-path or -d # custom ember path
103
+ --skip-git or -g # skip git keeps
104
+ --javascript-engine # engine for javascript (js, coffee or em)
105
+ --app-name or -n # custom ember app name
106
+ ```
107
+
98
108
  ## Configuration Options
99
109
 
100
110
  The following options are available for configuration in your application or environment-level
101
111
  config files (`config/application.rb`, `config/environments/development.rb`, etc.):
102
112
 
103
- * `config.ember.variant` - Used to determine which Ember variant to use. Valid options: `:development`, `:production`.
104
- * `config.ember.app_name` - Used to specify a default application name for all generators.
105
- * `config.ember.ember_path` - Used to specify a default custom root path for all generators.
106
- * `config.handlebars.precompile` - Used to enable or disable precompilation. Default value: `true`.
107
- * `config.handlebars.templates_root` - Set the root path (under `app/assets/javascripts`) for templates
108
- to be looked up in. Default value: `"templates"`.
109
- * `config.handlebars.templates_path_separator` - The path separator to use for templates. Default value: `'/'`.
110
- * `config.handlebars.output_type` - Configures the style of output (options are `:amd` and `:global`).
111
- Default value: `:global`.
113
+ | Configuration Option | Description |
114
+ |----------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
115
+ | `config.ember.variant` | Determines which Ember variant to use. Valid options: `:development`, `:production`. |
116
+ | `config.ember.app_name` | Specificies a default application name for all generators. |
117
+ | `config.ember.ember_path` | Specifies a default custom root path for all generators. |
118
+ | `config.handlebars.precompile` | Enables or disables precompilation. Default value: `true`. |
119
+ | `config.handlebars.templates_root` | Sets the root path (under `app/assets/javascripts`) for templates to be looked up in. Default value: `"templates"`. |
120
+ | `config.handlebars.templates_path_separator` | The path separator to use for templates. Default value: `'/'`. |
121
+ | `config.handlebars.output_type` | Configures the style of output (options are `:amd` and `:global`). Default value: `:global`. |
122
+
123
+ Note:
124
+
125
+ In a mountable engine, ember-rails will not recognize any configurations.
126
+ Instead, use command line options.
127
+
128
+ ## Enabling Features with Feature Flags
129
+ See [the guide](http://emberjs.com/guides/configuring-ember/feature-flags/#toc_flagging-details) and check [features.json](https://github.com/emberjs/ember.js/blob/master/features.json) for the version of Ember you're using.
130
+
131
+ If a feature is set to false, you will need to compile ember from source yourself to include it.
132
+
133
+ ### Important note for projects that render JSON responses
134
+
135
+ ember-rails includes [active_model_serializers](https://github.com/rails-api/active_model_serializers) which affects how ActiveModel and ActiveRecord objects get serialized to JSON, such as when using `render json:` or `respond_with`. By default active_model_serializers adds root elements to these responses (such as adding `{"posts": [...]}` for `render json: @posts`) which will affect the structure of your JSON responses.
136
+
137
+ To disable this effect on your JSON responses, put this in an initializer:
138
+ ```Ruby
139
+ # Stop active_model_serializers from adding root elements to JSON responses.
140
+ ActiveModel::Serializer.root = false
141
+ ActiveModel::ArraySerializer.root = false
142
+ ```
143
+
144
+ See the [active_model_serializers](https://github.com/rails-api/active_model_serializers) documentation for a more complete understanding of other effects this dependency might have on your app.
112
145
 
113
146
  ## Architecture
114
147
 
115
148
  Ember does not require an organized file structure. However, ember-rails allows you
116
149
  to use `rails g ember:bootstrap` to create the following directory structure under `app/assets/javascripts`:
117
150
 
118
- controllers/
119
- helpers/
120
- components/
121
- models/
122
- routes/
123
- templates/
124
- templates/components
125
- views/
151
+ ```
152
+ ├── components
153
+ ├── controllers
154
+ ├── helpers
155
+ ├── mixins
156
+ ├── models
157
+ ├── practicality.js.coffee
158
+ ├── router.js.coffee
159
+ ├── routes
160
+ ├── store.js.coffee
161
+ ├── templates
162
+ │ └── components
163
+ └── views
164
+ ```
126
165
 
127
166
  Additionally, it will add the following lines to `app/assets/javascripts/application.js`.
128
167
  By default, it uses the Rails Application's name and creates an `rails_app_name.js`
129
168
  file to set up application namespace and initial requires:
130
169
 
131
- //= require handlebars
132
- //= require ember
133
- //= require ember-data
134
- //= require_self
135
- //= require rails_app_name
136
- RailsAppName = Ember.Application.create();
170
+ ```javascript
171
+ //= require handlebars
172
+ //= require ember
173
+ //= require ember-data
174
+ //= require_self
175
+ //= require rails_app_name
176
+ RailsAppName = Ember.Application.create();
177
+ ```
137
178
 
138
179
  *Example:*
139
180
 
@@ -165,8 +206,7 @@ and including the assets in your layout:
165
206
 
166
207
  <%= javascript_include_tag "templates/admin_panel" %>
167
208
 
168
- If you want to strip template root from template names, add `templates_root` option to your application configuration block.
169
- By default, `templates_root` is `'templates'`.
209
+ If you want to avoid the `templates` prefix, set the `templates_root` option in your application configuration block:
170
210
 
171
211
  config.handlebars.templates_root = 'ember_templates'
172
212
 
@@ -191,7 +231,7 @@ Now a single line in the layout loads everything:
191
231
 
192
232
  <%= javascript_include_tag "templates/all" %>
193
233
 
194
- If you use Slim or Haml templates, you can use handlebars filter :
234
+ If you use Slim or Haml templates, you can use the handlebars filter :
195
235
 
196
236
  handlebars:
197
237
  <button {{action anActionName}}>OK</button>
@@ -208,23 +248,29 @@ When necessary, ember-rails adheres to a conventional folder structure. To creat
208
248
 
209
249
  *Example*
210
250
 
211
- With the following folder structure:
251
+ Given the following folder structure:
212
252
 
213
- components/
214
- controllers/
215
- helpers/
216
- models/
217
- routes/
218
- templates/
219
- components/
220
- my-component.handlebars
221
- views/
253
+ ```
254
+ ├── components
255
+ ├── controllers
256
+ ├── helpers
257
+ ├── mixins
258
+ ├── models
259
+ ├── practicality.js.coffee
260
+ ├── router.js.coffee
261
+ ├── routes
262
+ ├── store.js.coffee
263
+ ├── templates
264
+ │ └── components
265
+ │ └── my-component.handlebars
266
+ └── views
267
+ ```
222
268
 
223
- and a *my-component.handlebars* file with the following contents
269
+ and a `my-component.handlebars` file with the following contents:
224
270
 
225
271
  <h1>My Component</h1>
226
272
 
227
- will produce the following handlebars output
273
+ It will produce the following handlebars output:
228
274
 
229
275
  <script type="text/x-handlebars" id="components/my-component">
230
276
  <h1>My Component</h1>
@@ -260,7 +306,6 @@ RailsAppName.js.coffee
260
306
 
261
307
  These are automatically generated for you in new projects you when you run the `ember:bootstrap` generator.
262
308
 
263
-
264
309
  ## Specifying Different Versions of Ember/Handlebars/Ember-Data
265
310
 
266
311
  By default, ember-rails ships with the latest version of
@@ -272,7 +317,7 @@ To specify a different version that'll be used for both template
272
317
  precompilation and serving to the browser, you can specify the desired
273
318
  version of one of the above-linked gems in the Gemfile, e.g.:
274
319
 
275
- gem 'ember-source', '1.0.0'
320
+ gem 'ember-source', '1.7.0'
276
321
 
277
322
  You can also specify versions of 'handlebars-source' and
278
323
  'ember-data-source', but note that an appropriate 'handlebars-source'
@@ -37,7 +37,7 @@ module Ember
37
37
  if configuration.output_type == :amd
38
38
  target = amd_template_target(scope)
39
39
 
40
- "define('#{target}', ['exports'], function(__exports__){ __exports__.default = #{template} });"
40
+ "define('#{target}', ['exports'], function(__exports__){ __exports__['default'] = #{template} });"
41
41
  else
42
42
  target = global_template_target(scope)
43
43
 
@@ -1,5 +1,5 @@
1
1
  module Ember
2
2
  module Rails
3
- VERSION = '0.15.0'
3
+ VERSION = '0.15.1'
4
4
  end
5
5
  end
data/lib/ember_rails.rb CHANGED
@@ -26,10 +26,18 @@ module Ember
26
26
  # Copy over the desired ember, ember-data, and handlebars bundled in
27
27
  # ember-source, ember-data-source, and handlebars-source to a tmp folder.
28
28
  tmp_path = app.root.join("tmp/ember-rails")
29
- ext = variant == :production ? ".prod.js" : ".js"
30
29
  FileUtils.mkdir_p(tmp_path)
31
- FileUtils.cp(::Ember::Source.bundled_path_for("ember#{ext}"), tmp_path.join("ember.js"))
32
- FileUtils.cp(::Ember::Data::Source.bundled_path_for("ember-data#{ext}"), tmp_path.join("ember-data.js"))
30
+
31
+ if variant == :production
32
+ ember_ext = ".prod.js"
33
+ else
34
+ ember_ext = ".debug.js"
35
+ ember_ext = ".js" unless File.exist?(::Ember::Source.bundled_path_for("ember#{ember_ext}")) # Ember.js 1.9.0 or earlier has no "ember.debug.js"
36
+ end
37
+ FileUtils.cp(::Ember::Source.bundled_path_for("ember#{ember_ext}"), tmp_path.join("ember.js"))
38
+ ember_data_ext = variant == :production ? ".prod.js" : ".js"
39
+ FileUtils.cp(::Ember::Data::Source.bundled_path_for("ember-data#{ember_data_ext}"), tmp_path.join("ember-data.js"))
40
+
33
41
  app.assets.append_path(tmp_path)
34
42
 
35
43
  # Make the handlebars.js and handlebars.runtime.js bundled
@@ -73,35 +73,40 @@ module Ember
73
73
 
74
74
  private
75
75
 
76
-
77
76
  def get_ember_data_for(environment)
78
77
  # temporarily using a variable here until a stable release of
79
78
  # ember-data is released so that installing with ember-data
80
79
  # *just works*.
81
- chan = if channel == :release
80
+ chan = if channel.to_s == 'release'
82
81
  say_status("warning:", 'Ember Data is not available on the :release channel. Falling back to beta channel.' , :yellow)
83
82
  :beta
84
83
  else
85
84
  channel
86
85
  end
86
+
87
87
  create_file "vendor/assets/ember/#{environment}/ember-data.js" do
88
- fetch "#{base_url}/#{chan}/#{file_name_for('ember-data', environment)}", "vendor/assets/ember/#{environment}/ember-data.js"
88
+ fetch url_for(chan, 'ember-data', environment), "vendor/assets/ember/#{environment}/ember-data.js"
89
89
  end
90
90
  end
91
91
 
92
92
  def get_ember_js_for(environment)
93
-
94
93
  create_file "vendor/assets/ember/#{environment}/ember.js" do
95
- fetch "#{base_url}/#{channel}/#{file_name_for('ember', environment)}", "vendor/assets/ember/#{environment}/ember.js"
94
+ fetch url_for(channel, 'ember', environment), "vendor/assets/ember/#{environment}/ember.js"
96
95
  end
97
96
  end
98
97
 
99
- def file_name_for(component,environment)
98
+ def url_for(channel, component, environment)
99
+ base = "#{base_url}/#{channel}/#{component}"
100
+
100
101
  case environment
101
102
  when :production
102
- "#{component}.min.js"
103
+ "#{base}.min.js"
103
104
  when :development
104
- "#{component}.js"
105
+ if resource_exist?("#{base}.debug.js")
106
+ "#{base}.debug.js" # Ember.js 1.10.0.beta.1 or later
107
+ else
108
+ "#{base}.js"
109
+ end
105
110
  end
106
111
  end
107
112
 
@@ -174,6 +179,12 @@ module Ember
174
179
  output.rewind
175
180
  content = output.read
176
181
  end
182
+
183
+ def resource_exist?(target)
184
+ uri = URI(target)
185
+ response = Net::HTTP.new(uri.host, uri.port).head(uri.path)
186
+ response.code == '200'
187
+ end
177
188
  end
178
189
  end
179
190
  end
@@ -6,6 +6,12 @@ require "generators/ember/view_generator"
6
6
  module Rails
7
7
  module Generators
8
8
  ResourceGenerator.class_eval do
9
+
10
+ class_option :javascript_engine, :desc => "Engine for JavaScripts"
11
+ class_option :ember_path, :type => :string, :aliases => "-d", :default => false, :desc => "Custom ember app path"
12
+ class_option :with_template, :type => :boolean, :default => false, :desc => "Create template for this view"
13
+ class_option :app_name, :type => :string, :aliases => "-n", :default => false, :desc => "Custom ember app name"
14
+
9
15
  def add_ember
10
16
  say_status :invoke, "ember:model", :white
11
17
  with_padding do
@@ -14,7 +20,7 @@ module Rails
14
20
 
15
21
  say_status :invoke, "ember controller and view (singular)", :white
16
22
  with_padding do
17
- invoke "ember:view", [singular_name], :object => true
23
+ invoke "ember:view", [singular_name], options.merge(:object => true)
18
24
  end
19
25
 
20
26
  @_invocations[Ember::Generators::ControllerGenerator].delete "create_controller_files"
@@ -22,7 +28,7 @@ module Rails
22
28
 
23
29
  say_status :invoke, "ember controller and view (plural)", :white
24
30
  with_padding do
25
- invoke "ember:view", [plural_name], :array => true
31
+ invoke "ember:view", [plural_name], options.merge(:array => true)
26
32
  end
27
33
  end
28
34
  end
@@ -6,6 +6,6 @@
6
6
  //= require_tree ./helpers
7
7
  //= require_tree ./components
8
8
  //= require_tree ./templates
9
- //= require ./router
10
9
  //= require_tree ./routes
10
+ //= require ./router
11
11
  //= require_self
@@ -1,4 +1,5 @@
1
1
  #= require ./store
2
+ #= require_tree ./mixins
2
3
  #= require_tree ./models
3
4
  #= require_tree ./controllers
4
5
  #= require_tree ./views
@@ -1,8 +1,10 @@
1
1
  #= require ./store
2
+ #= require_tree ./mixins
2
3
  #= require_tree ./models
3
4
  #= require_tree ./controllers
4
5
  #= require_tree ./views
5
6
  #= require_tree ./helpers
7
+ #= require_tree ./components
6
8
  #= require_tree ./templates
7
9
  #= require_tree ./routes
8
10
  #= require ./router
@@ -1,3 +1,4 @@
1
+ #= require jquery
1
2
  #= require handlebars
2
3
  #= require ember
3
4
  #= require ember-data
@@ -4,7 +4,7 @@
4
4
  <% attributes.each_with_index do |attribute, idx| -%>
5
5
  <%= attribute[:name].camelize(:lower) %>: <%=
6
6
  if %w(references belongs_to).member?(attribute[:type])
7
- "DS.belongsTo('%s.%s')" % [application_name.camelize, attribute[:name].camelize]
7
+ "DS.belongsTo('%s')" % attribute[:name].camelize(:lower)
8
8
  else
9
9
  "DS.attr('%s')" % attribute[:type]
10
10
  end
@@ -4,7 +4,7 @@
4
4
  <% attributes.each do |attribute| -%>
5
5
  <%= attribute[:name].camelize(:lower) %>: <%=
6
6
  if %w(references belongs_to).member?(attribute[:type])
7
- "DS.belongsTo '%s.%s'" % [application_name.camelize, attribute[:name].camelize]
7
+ "DS.belongsTo '%s'" % attribute[:name].camelize(:lower)
8
8
  else
9
9
  "DS.attr '%s'" % attribute[:type]
10
10
  end
@@ -4,7 +4,7 @@ class <%= application_name.camelize %>.<%= class_name %> extends DS.Model
4
4
  <% attributes.each do |attribute| -%>
5
5
  <%= attribute[:name].camelize(:lower) %>: <%=
6
6
  if %w(references belongs_to).member?(attribute[:type])
7
- "DS.belongsTo '%s.%s'" % [application_name.camelize, attribute[:name].camelize]
7
+ "DS.belongsTo '%s'" % attribute[:name].camelize(:lower)
8
8
  else
9
9
  "DS.attr '%s'" % attribute[:type]
10
10
  end
@@ -1,9 +1,16 @@
1
- <%= application_name.camelize %>.Store = DS.Store.extend({
2
-
3
- });
4
-
5
1
  // Override the default adapter with the `DS.ActiveModelAdapter` which
6
2
  // is built to work nicely with the ActiveModel::Serializers gem.
7
3
  <%= application_name.camelize %>.ApplicationAdapter = DS.ActiveModelAdapter.extend({
8
4
 
9
5
  });
6
+
7
+
8
+ // Adds X-CSRF-Token to all REST requests.
9
+ // Allows for the use of Rails protect_from_forgery
10
+ // The CSRF Token is normally found in app/views/layouts/application.html.*
11
+ // inserted with the rails helper: "csrf_meta_tags"
12
+ DS.RESTAdapter.reopen({
13
+ headers: {
14
+ "X-CSRF-Token": $('meta[name="csrf-token"]').attr('content')
15
+ }
16
+ });
@@ -1,12 +1,17 @@
1
1
  # http://emberjs.com/guides/models/#toc_store
2
2
  # http://emberjs.com/guides/models/pushing-records-into-the-store/
3
3
 
4
- <%= application_name.camelize %>.Store = DS.Store.extend({
5
-
6
- })
7
-
8
4
  # Override the default adapter with the `DS.ActiveModelAdapter` which
9
5
  # is built to work nicely with the ActiveModel::Serializers gem.
10
6
  <%= application_name.camelize %>.ApplicationAdapter = DS.ActiveModelAdapter.extend({
11
7
 
12
8
  })
9
+
10
+ # Adds X-CSRF-Token to all REST requests.
11
+ # Allows for the use of Rails protect_from_forgery
12
+ # The CSRF Token is normally found in app/views/layouts/application.html.*
13
+ # inserted with the rails helper: "csrf_meta_tags"
14
+ DS.RESTAdapter.reopen(
15
+ headers:
16
+ "X-CSRF-Token": $('meta[name="csrf-token"]').attr('content')
17
+ )
@@ -1,5 +1,12 @@
1
- class <%= application_name.camelize %>.Store extends DS.Store
2
-
3
1
  # Override the default adapter with the `DS.ActiveModelAdapter` which
4
2
  # is built to work nicely with the ActiveModel::Serializers gem.
5
3
  class <%= application_name.camelize %>.ApplicationAdapter extends DS.ActiveModelAdapter
4
+
5
+ # Adds X-CSRF-Token to all REST requests.
6
+ # Allows for the use of Rails protect_from_forgery
7
+ # The CSRF Token is normally found in app/views/layouts/application.html.*
8
+ # inserted with the rails helper: "csrf_meta_tags"
9
+ DS.RESTAdapter.reopen(
10
+ headers:
11
+ "X-CSRF-Token": $('meta[name="csrf-token"]').attr('content')
12
+ )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ember-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Pitt
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-04-30 00:00:00.000000000 Z
14
+ date: 2014-12-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: execjs
@@ -145,14 +145,14 @@ dependencies:
145
145
  requirements:
146
146
  - - ">="
147
147
  - !ruby/object:Gem::Version
148
- version: '0'
148
+ version: 1.0.0
149
149
  type: :development
150
150
  prerelease: false
151
151
  version_requirements: !ruby/object:Gem::Requirement
152
152
  requirements:
153
153
  - - ">="
154
154
  - !ruby/object:Gem::Version
155
- version: '0'
155
+ version: 1.0.0
156
156
  - !ruby/object:Gem::Dependency
157
157
  name: tzinfo
158
158
  requirement: !ruby/object:Gem::Requirement
@@ -290,9 +290,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
290
  version: '0'
291
291
  requirements: []
292
292
  rubyforge_project:
293
- rubygems_version: 2.2.0
293
+ rubygems_version: 2.4.5
294
294
  signing_key:
295
295
  specification_version: 4
296
296
  summary: Ember for Rails 3.1+
297
297
  test_files: []
298
- has_rdoc: