ruby-on-rails3

Can we connect few models of a Rails 3 app to different type of database using the ActiveRecord adapter?

Let there is a rails 3 app with two models, a Project and Notification using the ActiveRecord adapter with MySql. Project has various states using state_machine and when its state changes, I want the notifications to be stored and retrieved back using MongoDb? Can this be done using rails3? ...

ActiveRecord Versioning plugin/gem compatible with rails3?

Hi, I googled for the the plugin/gem to do the ActiveRecord versioning for Rails3. But all I've got is not compatible for Rails3. I even searched in RailsPlugins.org too, but no luck. Do you know any that is Rails3 ready? ...

Installing rails-3.0.0.beta4 , and getting the royal (Errno::ENOENT)

First let me explain that I've created a million lib directories scouring out all the different responses to this same problem but none of them have really done the trick.. I've tried sudo mkdir /opt/local/lib/ruby1.9/gems/1.9.1/gems/rails-3.0.0.beta4/lib sudo mkdir /opt/local/lib/ruby1.9/gems/1.9/gems/rails-3.0.0.beta4/lib sudo mkdir ...

Query for all users except for users with an ID in this collection

I'm trying to find all users except for users with an id that is a member of an array exclude_ids Here's what I have: User.where("id != ?", exclude_ids) This only works when exclude_ids has only 1 element. If it has more than one element, I get this error: ActiveRecord::StatementInvalid: SQLite3::SQLException: near ",": syntax er...

Loading up first time server for Rails 3, and received this error..

Started GET "/users/new" for 127.0.0.1 at 2010-07-11 23:07:03 -0400 Processing by UsersController#new as HTML Completed in 15ms I18n::UnknownFileType (can not load translations from /Users/johnsmith/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.0.0.beta4/lib/active_support/locale/en.yml, the file type yml is not known): I check out...

Is there an rss parser that works with rails 3?

Are there any rss parsing solutions that work with the latest rails 3 beta? ...

Rails 3: 'The file type yml is not known' when trying to access basic _form.html.erb.

Hi folks, I'm trying to write up a very basic rails app, but any time I write up even the simplest form I get the following error: I18n::UnknownFileType in Posts#add Showing /home/john/Websites/sandbox/rails-messing/app/views/posts/_form.html.erb where line #14 raised: can not load translations from /usr/local/rvm/gems/ruby-head/gem...

How to find all items not related to another model - Rails 3

I have a fairly complicated lookup i'm trying to do in Rails and I'm not entirely sure how hoping someone can help. I have two models, User and Place. A user is related to Place twice. Once for visited_places and once for planned_places. Its a many to many relationship but using has_many :through. Here's the relationship from User. ...

Global variable for a database connection in Rails

I'm running Rails 3, and I've got several controllers that all do something like the following: @db = Mongo::Connection.new.db(MONGOID_CONFIG['database']) I don't want to have multiple connections to the database, so the natural thing would seem to be to wrap @db in some singleton that's initialized when I start the app. My question i...

Rails3 ":popup has been deprecated"

EDIT: I have accidentally awarded a bounty of 500 points for this question - please do not answer it as I did this without realising what was going on - yes I'm an idiot In rails 2.3.x, the following code would open a link in a popup window: = link_to "resource", resource_path(resource), :popup => true But in Rails 3 I get the error ...

Rails 3 'where' with no conditions or 'all' lazy loading

How can I get ActiveRecord::Relation object of the model without any conditions? Of cause I can write User.where # without any args , but thats looks confusing ...

How To Get Additional Attributes From Has Many Through

I am using Rails 3 beta 4. I have the following models: class Player < ActiveRecord::Base has_many :players_items, :dependent => :destroy has_many :items, :through => :players_items end class PlayersItem < ActiveRecord::Base belongs_to :player belongs_to :item end class Item < ActiveRecord::Base has_many :players_items, :d...

How to install a git plugin on Rails 3

Hey everyone, I'm completely new to Rails and just installed Rails 3 on Ubuntu 10.04. I was wondering if someone could please explain how to install a plugin from a Git repository. More specifically, I'm trying to install the restful-authentication plugin from the git repository: git://github.com/technoweenie/restful-authentication.git...

restful-authentication 'Could not find generator authenticated'

Hey everyone, I just installed the restful-authentication plugin on Rails 3, using: rails plugin install git://github.com/technoweenie/restful-authentication.git To generate the authentication files, the tutorial stated I should execute: ruby script/generate authenticated user sessions --include-activation (which in rails3 is): rail...

Rails3: validates_with, in what place I should put MyValidator?

I have an validator EmailValidator and class User: class EmailValidator < ActiveModel::Validator def validate(record) record.errors[:base] << "error" unless record.email.scan("@") end class User < ActiveRecord::Base validates_with EmailValidator end If I put EmailValidator definition in separate file in lib/ directory, or in...

Problem with default_scope in Rails 3? NoMethodError

I am experiencing a weird bug after adding this to my Alternative-model: default_scope order(:number) On the first page refresh, everything works fine. On subsequent refreshes, I get NoMethodError in Pages#show undefined method `written?' for #<Alternative:0x10455c558> Alternative most assuredly has the written? method. I am runni...

Rails using a join model attribute in a condition for a find

Hey all, I'm using a :has_many, :through association to link two models, User and Place It looks like this - In User: has_many :user_places has_many :places, :through=>:user_places In Place: has_many :user_places has_many :users, :through=>:user_places In User_Place belongs_to :user belongs_to :place belongs_to...

Do I really have to install the bundler 1.0.0.beta.3 to run the latest edge rails?

When I do bundle install bundling edge rails I get this error: No compatible versions could be found for required dependencies: Conflict on: "bundler": * bundler (0.9.26) activated by bundler (= 0.9.26, runtime) * bundler (>= 1.0.0.beta.3, runtime) required by rails (>= 0, runtime) All possible versions of origin require...

rails g rspec:install << returns >> Could not find generator rspec:install.

I can't get rSpec installed for Rails 3. I'm running Ruby -v=1.8.7, Rails -v=3.0.0.beta4 So far I have.. git clone git://github.com/indirect/rails3-generators.git lib/generators My GemFile : group :test do gem 'rspec' gem 'rspec-rails' gem "factory_girl" gem 'cucumber-rails' end I ran : bundle install Then : ...

Combine arrays of conditions in Rails

I'm using the Rails3 beta, will_paginate gem, and the geokit gem & plugin. As the geokit-rails plugin, doesn't seem to support Rails3 scopes (including the :origin symbol is the issue), I need to use the .find syntax. In lieu of scopes, I need to combine two sets of criteria in array format: I have a default condition: conditions = [...