A New World of Resources
2011-05-23 22:04:00 +0000
Last year I attacked a long lost black sheep of the Rails family, ActionMailer. This was because I had a project that needed to use email and I found the current implementation, shall we say, somewhat lacking. This year, I’m turning my attention to really the only remaining black sheep left, ActiveResource.
ActiveResource needs to be upgraded to be a real citizen in the Rails 3 family, in fact, in the last few years there have only been very minor fixes to ActiveResource while the rest of the world moved forward.
So what do we have? Happily, working code.
ActiveResource, as it stands now, works for the simplest of cases. If you have a controller exposing a Rails REST based resource, and you point ActiveResource at it, you will be able to perform the basic CRUD operations you have come to know and love.
But if you want to go any further, you are on your own.
Associations with ActiveRecord objects don’t work, validations need attention, bulk updates and transactional support are missing entirely. The code is really as it was when it was first released.
With the world moving towards using rich clients that hit a back end API that abstracts the data layer, these things need to change. Having your front end client go to delete 100 records requiring 100 requests to complete is no fun, and a waste of time.
Sure you as a developer can dive in and create all these things. But that is the problem. With each developer rolling their own we end up with a mass of Rails apps that are all different, which increases the work load for all of us. ActiveResource must provide the same level of opinionated functionality as the rest of Rails. There needs to be a reasonable opinion on how to provide an API, a template that you can reasonably expect all Rails applications to follow.
The way I see it, there are two broad use cases for ActiveResource and the code that is exposed in the controllers. Firstly we have the “bolt on API”, this is the API that is simply added to existing controller code typically using respond_to and returning JSON or XML representations of objects.
The second type though is the pure API, these are the APIs that are built from the ground up only to talk to other systems, the API at rubygems.org is a good example of this. It is not a patch on existing functionality, but instead a core member of the entire application.
With the above in mind, I want to implement the following into ActiveResource:
- Opinionated way to produce a “pure API” with Rails (think “rails generate api” for Rails applications that need to expose a separate, formal API for rich clients)
- Support for bulk updates of objects to existing controllers (show_many, change_many, update_many and destroy_many) – see idea in David’s Gist
- Transactional support for bulk operations
- Support for multi type operations (for example, updating the post and the author at the same time) outlined in the Rails Conf talk by Yehuda Katz
- Association support – providing connections through to local ORMs
- Better validation handling and reliable ways to communicate error messages to client apps
The above is not an exhaustive list and I am interested in your comments. If you are interested in helping, send me an email or tweet to (@raasdnil)
I’ll be posting updates here and on my twitter feed as we move forward.
blogLater
Mikel




2012-08-21 03:26:42 +0000
This blog is a great combination of suitable and useful information and well-written sentences that will certainly entice your sense and update you about new happening.
2012-08-08 03:19:09 +0000
I love travelling so much that I often surfing on many journey forum to learn knowledge about tripdishwashers reviews.
2012-08-08 03:36:55 +0000
I think your post and site is wonderfully constructed best stroller.
2012-09-07 03:19:48 +0000
Buying a wrist watch and stein diamonds review is a matter of many considerations that one should pay proper attention to have the right one.
2012-08-10 20:19:08 +0000
Nice Article, I feel strongly that love and read more on this topic. it’s very spectaculer….
Mesin Kasir | Komputer Kasir | Jual Barcode | Printer Kasir
Printer Kartu
2012-09-07 03:20:18 +0000
Buying a wrist watch and stein diamonds review is a matter of many considerations that one should pay proper attention to have the right one.
2012-08-10 20:38:04 +0000
I realy like this article. This is a hash of default values for any email you send, in this case we are setting from the header to a value for all messages in this class, this can be overridden on a per email basis..
Mesin Kasir | Komputer Kasir | Jual Barcode | Printer Kasir
Printer Kartu
2012-08-25 08:24:44 +0000
This is all assuming the image server is the same as the server running the request. If the image server is hosted elsewhere, you have to output a constant here. best essay writing service
2011-11-08 19:26:39 +0000
Great news! I hope You’ll be able to finish the work in reasonable amount of time. :)
2011-11-30 08:03:29 +0000
One more thing that is sorely missing is lazy eval of AResource ala ARecord. This is essential for even trying HTTP streaming via 3.1. Are you interested in this? I am planning on implementing this sometime soon (within the next couple of days) – so if you are interested, please contact me asap.
2011-05-24 04:49:20 +0000
Nice!
I guess the associations between active resources and nested attributes are priority. At least for me :)
Good luck!
2011-05-24 20:00:04 +0000
restfulie, links to find the api
2011-05-24 20:00:11 +0000
restfulie, links to find the api
2011-05-25 03:46:47 +0000
Great news! I hope You’ll be able to finish the work in reasonable amount of time. :)
2011-06-20 02:04:00 +0000
Effectively it’s really necessary to improve ActiveResource!
2012-05-19 17:24:21 +0000
Climate change concerns, coupled with high oil prices, peak oil, and increasing government support, are driving increasing renewable energy legislation, incentives and commercialization. New government spending, regulation and policies helped the industry weather the global financial crisis better than many other sectors.
2012-08-31 05:24:32 +0000
Some of the wrist watches are especially made for men as they have some extra features that you want to look in gents watches.
stein diamonds review
2012-08-31 05:26:58 +0000
Some of the wrist watches are especially made for men as they have some extra features that you want to look in gents watches.
2012-08-31 05:26:48 +0000
Some of the wrist watches are especially made for men as they have some extra features that you want to look in gents watches.
2012-08-31 05:26:21 +0000
Some of the wrist watches are especially made for men as they have some extra features that you want to look in gents watches.
stein diamonds review
2012-08-31 05:26:58 +0000
Some of the wrist watches are especially made for men as they have some extra features that you want to look in gents watches.
2012-02-05 20:12:47 +0000
Great news! I hope You’ll be able to finish the work in reasonable amount of time. :)
2012-03-09 07:59:33 +0000
Good Work ! This is essential for even trying HTTP streaming via 3.1. Thanks for posting!
2012-04-20 04:54:11 +0000
One more thing that is sorely missing is lazy eval of AResource ala ARecord. This is essential for even trying HTTP streaming via 3.1. Are you interested in this?
2012-04-21 02:51:39 +0000
The way I see it, there are two broad use cases for ActiveResource and the code that is exposed in the controllers. Firstly we have the “bolt on API”, this is the API that is simply added to existing controller code typically using respond_to and returning JSON or XML representations of objects.
2012-07-12 14:20:56 +0000
Great news! Congratulation for the courage
2012-09-17 00:55:01 +0000
Thanks for posting this Mikel, it’s always interesting seeing what solutions are being used in production.idateasia scam
2012-09-06 09:11:22 +0000
Rolling stock in railway transport systems generally has lower frictional resistance when compared with highway vehicles, and the passenger and freight cars can be coupled into longer trains. The operation is carried out by a railway company, providing transport between train stations or freight customer facilities. heimarbeit findet
2012-09-27 08:40:26 +0000
If you’re going to add automated webinar replays to your marketing plan, good choice.For more details visit to click here
2012-10-30 09:59:14 +0000
Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites..Body based learning | women want in bed | why men cheat
2012-12-10 18:52:12 +0000
I really like following your blog as the articles are so simple to read and follow. Excellent. Please keep up the good work. Thanks…. usb safe
2012-12-22 20:12:09 +0000
When a product is purchased, you initiate a drop-shipping request, and do a payment according to the drop-shipping price list
hardware keylogger
2012-12-28 18:13:24 +0000
Eu gosto deste blog. É um tema rico conteúdo. Isso me ajuda a resolver um monte de problemas. Ele atualiza a um ritmo muito poquer Brasil rápido, e prevê-me muitos opportunit
2013-01-04 09:38:01 +0000
The website is looking bit flashy and it catches the visitors eyes. Design is pretty simple and a good user friendly interface.PS3 Emulator
2013-01-12 09:22:41 +0000
I am really enjoying reading your well written articles. I think you spend numerous effort and time updating your blog. I have fashion accessories online bookmarked it and I am taking a look ahead to reading new articles. Please keep up the good articles!
2013-01-14 18:18:36 +0000
Thanks so much for this! I have not been this thrilled by a blog post for quite some time! You’ve got it, whatever that means in blogging. Anyway, You’re definitely someone that has something to say that people should hear. Keep up the wonderful job. Keep on inspiring the people!
2013-01-14 18:19:02 +0000
Thanks so much for this! I have not been this thrilled by a blog post for quite some time! You’ve got it, whatever that means in blogging. Anyway, You’re definitely someone that has something to say that people should hear. Keep up the wonderful job. Keep on inspiring the people!
2013-01-14 18:19:15 +0000
Thanks so much for this! I have not been this thrilled by a blog post for quite some time! You’ve got it, whatever that means in blogging. Anyway, You’re definitely someone that has something to say that people should hear. Keep up the wonderful job. Keep on inspiring the people!
2013-01-14 18:20:42 +0000
Thanks so much for this! I have not been this thrilled by a blog post for quite some time! You’ve got it, whatever that means in blogging. Anyway, You’re definitely someone that has something to say that people should hear. Keep up the wonderful job. Keep on inspiring the people!
shop scarves online
2013-01-19 09:54:13 +0000
This is my first time at your blog and I’ve really enjoyed looking around. I will come back again in the future to check out some of the other articles.Xbox Emulator
2013-01-21 08:57:10 +0000
Hi Friends,
I’d like to tell you about a very good resource to earn cash daily. Here you can get paid for multi-tasking which includes:
1) Daily Surveys (Excellent for Tier 1 & 2 Countries as they can make many dollars in a single day and every day).
2) Completing Micro-Tasks (Excellent for Worldwide members). Here you can earn more than $20 per day if the proper tasks are available.
3) Getting Paid For Clicking
4) Completing Offers (Offers ranging from signing up to a site to install a software etc)
Apart from 4 points mentioned above, there are many more ways to earn which you can find out right after registering. If you decide to join from my link, I will give you full support in learning about how this thing actually works.
If you haven’t given it a try yet, it is the time now.. You’ve got nothing to lose here..
Here is the link: http://www.clixsense.com/?3956223
Well Wishes
2013-04-20 03:36:44 +0000
Aloha http://xxxabp.com nzaog cxqoh http://fnkjva.com fsexo vqpkj http://rlnftq.com creob beoem http://rrkixe.com golir ryosz http://jrhkqv.com wbmed kvxcy
2013-04-20 03:36:44 +0000
Aloha http://odgtcx.com rlylw ddpyk http://lagmew.com vpdxm exhgw http://ftyiqe.com jpoth aocwj http://rfykpw.com dzkgo qzllw http://ixvtvu.com njzcl vgyjc
2013-04-21 10:17:00 +0000
Aloha http://rapisl.com joryn vjdke http://tmogmc.com ijbiz xjvwx http://uzifey.com omjqr upjbv http://dkduhq.com cdfqu roltm http://vtjhhq.com cnxsc ecslh
2013-04-21 10:17:11 +0000
Aloha http://kfklwg.com nmsuu axxoa http://euauca.com hqbnl aqzkr http://tuwttd.com hntfj cryru http://ocgaon.com bkenp udmoy http://ihctty.com gxudu ubedz
2013-04-30 05:07:05 +0000
Aloha http://fdxfpr.com wacvm gtvrp http://irstia.com rtbqn defsp http://tgsaed.com zrmdc zqvbi http://vpvmvl.com crdit mklxn http://wcrlrh.com brpfo cntkj
2013-05-06 23:09:07 +0000
Aloha http://pvpbpg.com uxbib zhtzp http://prghfw.com ucbyo fgxcp http://uwcdlj.com zohnd bmlto http://vhaemt.com ogyme jwycr http://mmxvev.com osdwt kprze
2013-05-07 00:32:38 +0000
Aloha http://ypugmq.com ubypc zdgxk http://qvfhed.com dxrwu obvok http://qjlotj.com esdrg pohls http://mxwobd.com zdjgv mqhpa http://tetyxk.com gwdhl cpoqn
2013-05-11 02:08:10 +0000
Great post. bean bags It’s good to see you to verbalize your heart and your clarity on this important issue can be easily detected. chairs Looking forward to read more. furniture beanbagnerd.com sofa
2013-05-15 11:10:49 +0000
When I initially commented I clicked the “Notify me when new comments are added” checkbox and
now each time a comment is added I get three emails with the same
comment. Is there any way you can remove people from that service?
Many thanks!