eyeballs 0.5.13 → 0.5.13.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -115,7 +115,7 @@ You define a model by passing a name and function to the eyeballs ( o_O ) functi
115
115
  You can now initialize an individual post:
116
116
 
117
117
  var post = Post.initialize({title: 'My New Post'});
118
- post.title #=> 'My New Post'
118
+ post.title //=> 'My New Post'
119
119
 
120
120
  Not very exciting.
121
121
 
@@ -128,10 +128,11 @@ However, if you're familiar with Rails, you'll be familiar with the wonderful sy
128
128
  Now, when you initialize a new Post, you can validate it, nice and easy:
129
129
 
130
130
  var post = Post.initialize()
131
- post.errors # => [{
132
- # field: 'title',
133
- # message: 'title should be present',
134
- # type: 'presence'}]
131
+ post.valid()
132
+ post.errors // => [{
133
+ // field: 'title',
134
+ // message: 'title should be present',
135
+ // type: 'presence'}]
135
136
 
136
137
  and so on, so forth. This will be very familiar to those who use Rails.
137
138
 
@@ -148,9 +149,18 @@ You can also add your own validations, again, similar to how Rails does things:
148
149
 
149
150
  var post = Post.initialize()
150
151
  post.save(function(saved_post){
151
- post.errors # => [{
152
- # message: 'title should be present'}]
153
- }) # yep, there's a save method too!
152
+ post.errors // => [{
153
+ // message: 'title should be present'}]
154
+ }) // yep, there's a save method too!
155
+
156
+ Even better, using the `invalid` callback:
157
+
158
+ post.save({
159
+ invalid: function(saved_post){
160
+ // you can assume:
161
+ saved_post.errors
162
+ }
163
+ })
154
164
 
155
165
  When you want to find things:
156
166
 
@@ -172,7 +182,7 @@ And if you want to add your own methods:
172
182
  })
173
183
 
174
184
  var post = Post.initialize({title: "HUGE"})
175
- post.title_downcased() #=> 'huge'
185
+ post.title_downcased() //=> 'huge'
176
186
 
177
187
  Connecting to an adapter:
178
188
 
@@ -221,7 +231,7 @@ There are several ways to bind events to controller actions.
221
231
 
222
232
  The simplest way to call controller actions is to bind them directly. From the above example, you can simply call:
223
233
 
224
- PostsController.new()
234
+ o_O('PostsController').new()
225
235
 
226
236
  ...once you have initialized your controller.
227
237
 
@@ -261,7 +271,7 @@ and your controller:
261
271
 
262
272
  o_O('PostsController', {
263
273
  show: function(){
264
- alert(o_O.params('id')) #=> '1'
274
+ alert(o_O.params('id')) //=> '1'
265
275
  }
266
276
  })
267
277
 
@@ -357,7 +367,11 @@ Running the tests
357
367
 
358
368
  eyeballs.js uses QUnit for in-browser testing. Just load the files in the test directory in any browser to run them.
359
369
 
360
- For the REST tests, you can use the included Sinatra app, `app.rb`. The tests expect it to be in a local virtual domain `http://eyeballs`
370
+ For the REST tests, you can use the included Sinatra app, `app.rb`. The tests expect it to be in a local virtual domain `http://localhost:4567`
371
+
372
+ Contributors
373
+ ------------
374
+ - Anthony Eden ([aeden](/aeden))
361
375
 
362
376
  About me
363
377
  --------
data/Rakefile CHANGED
@@ -27,7 +27,7 @@ begin
27
27
  require 'jeweler'
28
28
  Jeweler::Tasks.new do |s|
29
29
  s.name = "eyeballs"
30
- s.version = "0.5.13"
30
+ s.version = "0.5.13.1"
31
31
  s.author = "Paul Campbell"
32
32
  s.email = "paul@rslw.com"
33
33
  s.homepage = "http://www.github.com/paulca/eyeballs.js"
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{eyeballs}
8
- s.version = "0.5.13"
8
+ s.version = "0.5.13.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Paul Campbell"]
@@ -125,23 +125,23 @@ o_O.rest = {
125
125
  var url = this.figure_url(options, model) + '/' + id;
126
126
  var include_json_root = this.include_json_root(model)
127
127
  $.get(url, function(response){
128
- if(typeof response === 'object')
129
- {
130
- var retrieved_object = response;
131
- }
132
- else
133
- {
134
- try{
128
+ try{
129
+ if(typeof response === 'object')
130
+ {
131
+ var retrieved_object = response;
132
+ }
133
+ else
134
+ {
135
135
  var retrieved_object = JSON.parse(response);
136
- if(include_json_root)
137
- {
138
- retrieved_object = retrieved_object[model.model_name.underscore()]
139
- }
140
136
  }
141
- catch(e){
142
- var retrieved_object = model.initialize({id: id});
137
+ if(include_json_root)
138
+ {
139
+ retrieved_object = retrieved_object[model.model_name.underscore()]
143
140
  }
144
141
  }
142
+ catch(e){
143
+ var retrieved_object = model.initialize({id: id});
144
+ }
145
145
  if(typeof callback === 'function')
146
146
  {
147
147
  retrieved_object.new_record = false;
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eyeballs
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 81
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
9
  - 13
10
- version: 0.5.13
10
+ - 1
11
+ version: 0.5.13.1
11
12
  platform: ruby
12
13
  authors:
13
14
  - Paul Campbell