Commit Graph

227 Commits

Author SHA1 Message Date
Yehuda Katz
67f5d611f5 Add rake gemspec and gemspecs to the repo 2009-08-31 17:20:44 -07:00
taryn
ce61a6bd55 Added first/last/all aliases for equivalent find scopes
Just a copy from Active Record (with tests). Each is a warpper function for
the equivalent scoped call to find eg first is a wrapper for find(:first)

Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-21 14:49:59 -05:00
taryn
328ba3b333 Added save! which raises ResourceInvalid unless valid?
Similar to Active Record - it will raise ActiveResouce::ResourceInvalid if
the resource is not valid (ie if <tt>valid?</tt> returns false)

However - does not raise ActiveResource::ResourceNotFound if the callbacks
fail (callbacks have not yet been implemented) - it will just try to save
and raise if the callbacks all fail.

This is not ideal behaviour - but will do until we decide to change the
behaviour of save_with_validations to actually raise (rather than catch) the
ResourceInvalid exception.

Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-19 09:05:02 -05:00
taryn
4dc05bc8a9 Swallow ResourceNotFound error on find_every
Active Record does not explode with RecordNotFound if you go looking for a
collection of objects - it just returns nil. Thus Active Resource should
also not explode.

After all - finding no objects that match a set of conditions is not
exceptional behaviour - unlike looking for a specific object with a given id
(which you'd expect to exist).

I've also added documentation to +find+ to reflect this.

Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-19 09:04:48 -05:00
taryn
079ed8fc43 Pulled find-based tests into their own test case. This matches Active Record, and allows us to have one places where all find-tests are located, which will help when adding dynamic finders later.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-19 09:04:14 -05:00
taryn
36bf587347 Moved all test cases into a new test/cases directory to match Active Record test directory structure.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-19 09:03:57 -05:00
taryn
c2f90d6530 Added validations to ActiveResource. Added a smoke test to see if we can add a validation and use it, and add a validates callback and use it.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-19 09:03:17 -05:00
Jatinder Singh
a363dba790 Fix ActiveResource load test for 64bit machines [#3051 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-15 20:29:37 +01:00
Fabien Jakimowicz
797588543e Add support for errors in JSON format.
[#1956 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:40:20 -07:00
Grzegorz Forysinski
e391c7a97c Ensure ActiveResource#load works with numeric arrays [Grzegorz Forysinski, Elad Meidar]
[#2305 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 23:39:38 +01:00
Jordan Brough
916b18adeb Active Resource recognizes 410 as Resource Gone now [#2316 state:resolved] [Jordan Brough, Jatinder Singh]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 22:56:32 +01:00
Jatinder Singh
1fc1986d6d Make ActiveResource#exists? work [#3020 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 22:24:57 +01:00
Roy Nicholson
3e0951632c Add ability to set SSL options on ARes connections.
[#2370 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 13:24:05 -07:00
Jeremy Kemper
a0caad5255 Setting connection timeout also affects Net::HTTP open_timeout.
[#2947 state:resolved]
2009-08-09 02:28:00 -07:00
Marshall Huss
4d1552810f HTTP proxy support
[#2133 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-08 15:33:55 -07:00
Brendan Schwartz
201387496e Ruby 1.9 compat: fix for SSL in Active Resource
[#1272 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-07 12:24:02 -07:00
Joshua Peek
7c84bbf160 Add wrap_with_notifications helper to AMo observing 2009-07-20 23:57:01 -05:00
Joshua Peek
c863388039 Add observing hooks to ARes 2009-07-11 16:59:11 -05:00
Yehuda Katz + Carl Lerche
7583a24ee0 Move mocha down below initial T::U require and bump version to 0.9.7 [#2858 state:resolved] 2009-07-01 11:53:17 -07:00
Carl Lerche
db3de78a83 Bump up the version to 3.0.pre 2009-06-30 14:37:12 -07:00
Joshua Peek
1c4d28ba31 Move model naming into ActiveModel 2009-06-17 10:37:39 -05:00
Jeremy Kemper
5b256ac369 Prefer JSON.encode(value) to value.to_json 2009-06-08 19:37:52 -07:00
Joshua Peek
27766ccf3b Make use of AS::Concern in ActiveResource 2009-06-08 20:52:27 -05:00
Joshua Peek
0b694a4ff4 Setup ActiveResource autoloads 2009-06-08 20:48:14 -05:00
Jeremy Kemper
00ee990443 JSON: split encoding and coercion 2009-06-08 13:21:30 -07:00
Jeremy Kemper
85eb3af873 Tolerate missing logger 2009-05-30 11:59:17 -07:00
Jeremy Kemper
3962be5b8c Use URI and Inflector 2009-05-30 11:59:17 -07:00
Joshua Peek
69742ca8fa Merge branch 'master' into active_model
Conflicts:
	activemodel/lib/active_model/core.rb
	activemodel/test/cases/state_machine/event_test.rb
	activemodel/test/cases/state_machine/state_transition_test.rb
	activerecord/lib/active_record/validations.rb
	activerecord/test/cases/validations/i18n_validation_test.rb
	activeresource/lib/active_resource.rb
	activeresource/test/abstract_unit.rb
2009-05-29 16:06:21 -05:00
Jeremy Kemper
4f291fa528 Simple examples for require profiling 2009-05-13 12:00:49 -07:00
Jeremy Kemper
e8550ee032 Cherry-pick core extensions 2009-05-13 12:00:15 -07:00
Jeremy Kemper
49ed452136 Defer rake/contrib/sshpublisher require so basic tasks don't need the full rake gem 2009-05-07 18:27:50 -07:00
Jeremy Kemper
201d8b1755 Fix tests on 1.8.6 2009-05-06 12:19:30 -07:00
Jeremy Kemper
6d4a4fabbb Cherry pick Active Support dependencies. Autoload. 2009-05-06 00:14:55 -07:00
Jeremy Kemper
c585e263ab Remove superfluous CGI require 2009-05-05 21:50:53 -07:00
Jeremy Kemper
a05cfb6df5 Prefer sibling Active Support 2009-05-05 21:44:02 -07:00
Jeremy Kemper
6e3e00219b Fix differing rails_to_json arity 2009-04-26 20:26:44 -07:00
rick
3c4c6bd0df * Add pluggable JSON backends with support for the JSON gem. [rick]
Example: ActiveSupport::JSON.backend = "JSONGem"

  All internal Rails JSON encoding is now handled by ActiveSupport::JSON.encode().  Use of #to_json is not recommended, as it may clash with other libraries that overwrite it.  However, you can recover Rails specific functionality
  if you really want to use #to_json.

    gem 'json'
    ActiveSupport::JSON.backend = "JSONGem"

    class ActiveRecord::Base
      alias to_json rails_to_json
    end
2009-04-23 00:08:40 -07:00
Jeremy Kemper
6fee981fa4 Opt in to JSON 2009-04-22 16:48:58 -07:00
Jeremy Kemper
ab321268f8 No more free lunch 2009-04-22 16:10:49 -07:00
Pratik Naik
5f3f100ce2 Merge branch 'master' into active_model
Conflicts:
	activeresource/lib/active_resource/validations.rb
2009-04-22 15:26:03 +01:00
Pratik Naik
f97832b1e4 Merge docrails 2009-03-24 12:15:43 +00:00
Pratik Naik
320933205e Deprecate Errors#on_base/add_to_base/invalid?/each_full 2009-03-21 18:34:05 +00:00
Pratik Naik
09afbfd47f Fix ActiveResource::Errors deprecation messages 2009-03-20 18:51:01 +00:00
Pratik Naik
77acfefedf Make Active Resource use ActiveModel::Errors 2009-03-19 23:45:08 +00:00
David Heinemeier Hansson
73fc42cc0b Prepare for final 2.3 release 2009-03-15 22:06:50 -05:00
Jeremy Kemper
cfde60575a Strip invalid leading whitespace error uncovered by nokogiri 2009-03-10 22:17:05 -07:00
Jeremy Kemper
1c36172c13 Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.
[#1617 state:resolved]
2009-03-08 13:11:58 -07:00
Jeremy Kemper
0c407891fb Ensure Active Support is loaded locally rather than from RubyGems. [#1620 state:committed] 2009-03-08 11:04:23 -07:00
David Heinemeier Hansson
dfef3d8b14 Release RC2 today 2009-03-05 11:00:04 +01:00
David Heinemeier Hansson
7058c1366e So it didnt happen yesterday, but very soon! Just need the final details ironed out 2009-02-28 10:30:49 +01:00