ruby-on-rails3

Rails 3 api docs

I'm trying to find some api docs like http://api.rubyonrails.com but for the latest rails 3 release candidate. Is there an online version of them? Or is there a way to build the docs (using rake doc:rails) to make them look the same? ...

Stubbing Devise in rSpec and Rails3

How would you stub Devise in Rails 3 with rSpec. I have a UsersController and a User model. Both of which are associated with Devise at the moment, I'm writing controller specs and I really am having a hard time with my expectations as the Devise sign_in is really jamming up the works. Any thing will help. ...

undefined method `update_counters_without_lock in Rails3

I've been upgrading Rails2 app to Rails3, running specs and got this error: CommentsController destroy action renders back :success => true if comment is deleted Failure/Error: comment = Factory.create(:comment, :commentable => @question) undefined method `update_counters_without_lock' for #<Class:0x7f178ffe5850> I checked Rails3 API ...

Please help me setting up my Rails3 app testing tools

Hello, I'm starting a new rails 3 application, and I want it to be tested the better I can. This application is eavily based on plugins (wich will become gems later). One of this gem will be a proxy which talk with an API and outputs formatted data. Few plugins will process data sent by this proxy My questions : Should I use cucum...

Learning Ruby On Rails

I want to learn Ruby on Rails. I've done some work with various java frameworks but I can no longer ignore everyone RoR craze. I did some looking around and found that a lot of people recommend Agile Web Development with Rails as a good starting point. Would you agree? I was looking on the site for it (http://pragprog.com/titles/rail...

Creating a plist in Rails 3

Hi! I'm new to Rails and I'm trying to learn it using Rails 3 (RC). I have managed to use http://plist.rubyforge.org/ for supporting the output of plists. I would like to check with you guys to see if my approach is the right way to do it. Here goes: In the gemfile I added gem 'plist' In config/initializers/mime_types.rb I added Mime:...

Getting Rails 3 Generators with Rspec 2 and Mocha

I've followed all of the steps that I've been able to find online for configuring Rails 3 with Rspec 2 and Mocha. In my Gemfile: group :development do gem 'rails3-generators' gem "rspec", '>= 2.0.0.beta.19' gem "rspec-rails", '>= 2.0.0.beta.19' end group :test do gem "faker" gem "rspec", '>= 2.0.0.beta.19' gem "rspec-rails"...

Rails3 + Datamapper - concurrent database connections

Is it possible to use concurrent databases in one rails application? With AR I can use establish_connection method inside a model. Is it possible with datamapper? ...

MongoMapper - manually setting an ObjectId failing with "illegal ObjectID format"

I've got a simple model object: class UserRating include MongoMapper::EmbeddedDocument key :idea_id, ObjectId key :rating, Integer end I'm trying to set an Idea_Id on this object with: user_rating.idea_id = ObjectId.new This throws: "illegal ObjectID format" This sure seems like simple code... The only oddity I am noticing ...

problem: activerecord (rails3), chaining scopes with includes

In Rails3 there seems to be a problem when chaining two scopes (ActiveRelations) that each have a different include: Consider these two scopes, both of which work fine on their own: First scope: scope :global_only, lambda { |user| includes(:country) .where("countries.area_id <> ?", user.area) } Work.global_only(user) => (cut list of...

Ruby/Rails unique name generator

I have a User model which has_many Documents. Each Document's title must be unique within the scope of a User. This works as expected. class Document < ActiveRecord::Base has_many :documents, :dependent => :delete_all end class Document < ActiveRecord::Base belongs_to :user validates_presence_of :title validates_uniqueness_of...

CouchDB Database per Main Entity

Dears, i'm looking for implement in my application to have database for the main entity of the system. i'd like to create and set a database for this entity named with a property value. Like : For a CMS Project, to create a couchdb database for every Site. kindly, as that is based on Rest and Rails : in the create method i have the ...

Translation of models in Ruby on Rails 3.0

Using Ruby on Rails 3.0, I would like to have pages where posts have side-by-side translations. For example, a page would look like this +---------------+---------------+-----------------+ | Hello | Hola | Bonjour | +---------------+---------------+-----------------+ ... (there could be many more languages) | He...

How to call the deep_merge method from an installed gem (not the Rails3 deep_merge)

Rails 3 provides a deep_merge method on a Hash. What should I do to use the deep_merge method defined in a gem I installed instead? Wherever I require the gem, the deep_merge method from Rails is used. (The deep_merge gem installation page: http://trac.misuse.org/science/wiki/DeepMerge) The deep_merge gem module structure: module De...

Appropriate way to handle settings in Rails3 Plugin?

I'm working on a plugin for Rails3. I'd like to allow users to override some settings. At the moment I'm doing this inside my plugin's Rails::Engine class like: config.my_setting = :default_value unless config.respond_to? :my_setting This seems like the wrong way to handle this. Is there a better method or convention most plugins use ...

Macvim and rails.vim on rails 3 rc - Uninitialized constant Bundler (NameError)

Configured vim and gvim on Windows, as well as vim and macvim on OSX. Intend to learn rails 3, so installed rails 3 rc on both OS'ses. So far, so good. When using macvim, each and every script execution offered by rails.vim gives me errors "Uninitialized constant Bundler (NameError)". Tried :Rserver, :Rgenerate, .... However, staying on...

Should I switch to Rails 3 now?

According to their blog (http://weblog.rubyonrails.org/2010/7/26/rails-3-0-release-candidate), the release candidate for Rails 3.0 is out now, and the formal version will be coming in 'a few weeks'. I've been planning to rebuild my application using MongoDB anyway, should I go ahead with Rails 3.0.0.rc right now or wait for the formal ve...

SQLite3 error when testing Cancan authorizations in Rails3 : no such table: abilities: DELETE FROM "abilities" WHERE 1=1

Hi, I'm having issues when running the default tests in Rails3 beta4 with Cancan (http://github.com/ryanb/cancan). The tests are the plain vanilla auto-generated ones that look like test "the truth" do assert true end Every single test (both unit and functional) yields the following error : ActiveRecord::StatementInvalid: SQLite3::...

[Rails3] jQuery + Ajax + Haml. js.erb files not firing.

After reading up on a few experiences, I feel this issue might need to be brought up again. Coding in Rails3, I'm trying to implement some smooth Ajax effects when a user tries to create a post on another element of my app. Here's the code I'm concerned with: app/views/posts/new.html.haml - form_for @post, :remote=>true do |f| = ...

rails3 rc1 with prototype and jquery

I have a rails3 project where I need to use prototype together with jquery - using the current Ruby on Rails 3 RC1 there is no example or documentation to use both together without problems. Is there a setup instruction or did anyone get both javascript frameworks running with the latest rails version? thanks, z3cko ...