Rails ORM for CouchDB? - ruby-on-rails

MongoDB has two popular ORMs for Rails: MongoID and MongoMapper.
Are there CouchDB ORM:s for Rails 3?

I can't say for sure since I've never used it, but it looks like CouchRest would be the way to go - specifically "CouchRest Model" looks like has been updated to work with Rails3 ActiveModel.
FWIW, I landed on CouchRest after finding this thread.

there is couchRest as noted above, or if you like active record style try couch_foo. I had different needs when i was looking into couch this past spring, and using rails 3. Rails 3 should be ORM agnostic, so it shouldn't really mess with it, although I couldn't get testing to work easily, but that could have just been me.

Related

Rails: Act_as_taggable_on vs. Rocket_tag

Looks like Act_as_taggable_on is the more established gem, but Rocket_tag is the newer and hotter one.
Which one would you recommend, and why?
Most of the posts I found that compared Rails tagging were fairly outdated, and I was wondering if anyone knew something about Rocket_tag (not much info on it out there).
I used both.
I am very happy with act_as_taggable, but for Rails 3.1 I switched to rocket_tag.
On every project that is in rails <3.1 act_as_taggable.
Sorry, I do not have any oline resources, just my own opinion.
I'm the author of rocket_tag so I'm a bit biased. The reason I wrote rocket_tag was that I found the code for the other taggable gems to be messy and unreadable and thus hard to extend and play with. I generally use Ernie Millers excelent Squeel GEM for writing and composing database queries. Squeel is a super clean and powerful ruby DSL for putting together SQL.
If you have a need for some custom tagging query then I suggest taking a look at how rocket_tag is put together and trying to roll your own tagging analysis method.

Mongomapper - bootstrapping techniques

I've just begun creating a rails application using mongomapper for my models. I'm wondering what solution should I use for bootstrapping my app with it.
All my previous experience is with ActiveRecord & PostgreSQL, in which I have used several gems for bootstrapping. The one I liked the most was bootstrapper (+ factorygirl + faker).
Does anyone know whether these work ok with mongomapper? Can anyone suggest better alternatives? Is there anything obvious I need to know when bootstrapping mongodb?
Factory_girl and faker works fine with MongoMapper.
So you can bootstrap your Rails app in the same way that before. Made some data in your db/seed.rb

How to mix mongodb and a traditional db in Rails?

I am considering using MongoDB (mongo-mapper) for a portion of my rails application. I am not ready to go whole hog MongoDB because there are too many useful gems that depend on a traditional DB.
That being said there are parts of my application that would be great to leverage a document database.
Has anyone had success mixing the two approaches? How do you link activerecord models with mongomapper models?
MongoMapper doesn't implement ActiveModel yet, but I think there are a few forks on github that do. You could use Mongoid instead (which does) and your relationships between Mongoid docs and ActiveRecord entries would just magically work. I know a number of people are doing that.
That said, I wouldn't want to mix them unless I absolutely had to have an RDBMS for some reason.
Here a presentation about this issue: http://nosql.mypopescu.com/post/541657350/presentation-blending-nosql-and-sql-at-confoo
I don't know ROR so I can't judge it is a good presentation.
http://railscasts.com/episodes/194-mongodb-and-mongomapper
http://www.mongodb.org/display/DOCS/Object+Mappers+for+Ruby+and+MongoDB
http://www.mongodb.org/display/DOCS/MongoDB+Data+Modeling+and+Rails
http://www.mongodb.org/display/DOCS/Ruby+Language+Center
You need to mixin mongomapper with the model class
This gives you freedom to define the key-value pairs other than activerecord
include MongoMapper::Document
Dead simple I think.

Ruby Rails _without_ ActiveRecord

I'm looking for any pointers on how to write a rails web app without ActiveRecord.
A doc or an example of a (not too complex) web app using storage backends other than a relational database would be greatly appreciated.
It's not clear on what should be implemented in the model classes in order to make the rails app work without the ActiveRecord layer.
Thanks,
Of course it's possible, here, for example, MongoMapper is used instead of ActiveRecord:
http://railstips.org/blog/archives/2009/07/23/getting-started-with-mongomapper-and-rails/
Note that this will seem a lot easier with Rails 3. Rails team spent a lot of efforts on ORM agnosticism when pushing to beta. They've created a public API (ActiveModel) for different ORMs to implement, so that an ORM can serve as a drop-in replacement for ActiveRecord. That way you'll just be able to define models in terms of your ORM without any extra efforts.
DataMapper already has an implementation of ActiveModel in dm-rails, and there'll be more to come.
See this post by Yehuda Katz for details.

Is there a good admin generator for Ruby on Rails?

My current project is in Rails. Coming from a Symfony (PHP) and Django (Python) background, they both have excellent admin generators. Seems like this is missing in Rails.
For those who aren't familiar with Symfony or Django, they both allow you to specify some metadata around your models to automatically (dynamically) generate an admin interface to do the common CRUD operations. You can create an entire Intranet with only a few commands or lines of code. They have a good appearance and are extensible enough for 99% of your admin needs.
I've looked for something similar for Rails, but all of the projects either have no activity or they died long ago. Is there anything to generate an intranet/admin site for a rails app other than scaffolding?
Active Admin (http://activeadmin.info/) was released in May of 2011, and looks like it's going to become the best Rails 3 option.
rails_admin appears to be the latest-n-greatest free project as of January 2011.
...best of all, there has been a lot of activity in the repository.
Scaffolding is the normal way to create an admin backend BUT there is a project called ActiveScaffold which may solve your problem.
Here is a roundup of a few options, including more than just ActiveScaffold.
ActiveScaffold is available for Rails 2.3.x :)
Just for someonse's info who have found this question one year later like me :)
ActiveScaffold is a good solution, but if you want a more configurable and powerful tool, I think Typus is a great solution:
http://github.com/fesplugas/typus
You have mainly two:
ActiveScaffolding: the most popular but be careful with rails 2.1
Streamlined
ActiveScaffold is by far and away the most configurable/easiest to integrate/most automagic scaffolding around at the moment.
It has built in ajax support, near seamless db introspection and it even plays nicely with legacy Oracle databases (which can be a real pain in Rails).
Try it: http://activescaffold.com/
Have a look at Casein (http://www.caseincms.com/), might be what you're looking for.
Having also tried typus, caseincms and ActiveScaffold over the weekend, I can't rave enough about admin_data.
It is
super-quick to install (Rails 3 is the gem, Rails 2.3 is a plugin branch,
no digging through trees on github),
unintrusive (all code is in the vendor/admin_data folder or the gem where it belongs),
requires no set-up and optional configuration is one block in one file in your app,
correctly (!) gets all model information from your model definitions (primary_key, foreign_key, relationships etc.),
including multiple databases, SQL Server connections via activerecord-sqlserver-adapter, and even composite primary keys, as everything is abstracted on top of ActiveRecord, if you model works, admin_data will work,
works great with legacy data for the above reasons,
uses your existing authentication solution which is called in the most wonderful DRYness in your configuration file.
It maybe less flexible or pretty than other solutions, but this plugin does many thingks right for quick admin panel setup.
The most common way to create a CRUD interface is to use Scaffold.
./script/generate scaffold_resource MyModel property:type property2:type2
This command would generate a CRUD interface for the model named MyModel (singular) with two properties. Properties is what's called columns in DB lingo. So you could have name:string age:integer active:boolean etc.
I can suggest you active_admin that is best
Active Admin main site

Resources