ruby-on-rails3

How to completely uninstall rails 3.0.0.beta3 and all its dependencies?

If I do sudo gem uninstall rails -v 3.0.0.beta3, it uninstalls rails but leaves the beta3 versions of activerecord, actionmailer, etc. How do I completely uninstall rails 3.0.0.beta3 and all its dependencies automatically? I would like a clean slate for the RC and final releases. ...

Are there any stable solutions for using Rails 3.0 and Facebook together?

I've seen reports that Facebooker doesn't work with Rails 3. I've noticed that there's a Facebooker2 project, but it doesn't seem to have any documentation and there's no information I can find about its Rails 3 compatibility. Are there any good choices for getting Facebook Connect working with a website built on Rails 3.0.0 (beta4)? ...

uninitialized constant MysqlCompat::MysqlRes (mysql gem error) on Ubuntu, not fixing

I'm on Ubuntu 10.04 x64, ruby version 1.8.7 (2010-01-10 patchlevel 249) I've read this thread first: http://stackoverflow.com/questions/1332207/uninitialized-constant-mysqlcompatmysqlres-using-mms2r-gem and tried everything that people suggested: apt-get install libmysqlclient-dev export ARCHFLAGS="-arch x86_64"; sudo gem install --no...

Rails: translate ActiveRecord error template headers for a single model

Hi, I'm trying to rename the authlogic error messages in a Rails 3 app. The general format I found out working in Rails 3: de: errors: template: header: one: "Konnte {{model}} nicht speichern: ein Fehler." other: "Konnte {{model}} nicht speichern: {{count}} Fehler." body: "Bitte überprüfen Sie die...

Missing script/generate in Rails 3

I just installed Rails 3 and created my first app. The install of Rails3 + ruby 1.9 went very smoothly but I am missing the generate script in script/generate. I have created a new app from scratch with no options to verify. Any idea why this is happening and how to fix it? ...

How to test a scope in Rails 3

What's the best way to test scopes in Rails 3. In rails 2, I would do something like: Rspec: it 'should have a top_level scope' do Category.top_level.proxy_options.should == {:conditions => {:parent_id => nil}} end This fails in rails 3 with a "undefined method `proxy_options' for []:ActiveRecord::Relation" error. How are peopl...

Specifying Entire Path As Optional Rails 3.0.0

I want to create a Rails 3 route with entirely optional parameters. The example broken route is: match '(/name/:name)(/height/:height)(/weight/:weight)' => 'people#index' Which results in 'rake:routes' yielding: /(/name/:name)(/height/:height)(/weight/:weight) And thus adding an initial slash to all links: <a href="//name/kevi...

How can I get ambethia's captcha plugin to work in rails 3?

I have installed ambethia's captcha plugin as a plugin in my rails 3 app. When I put the <%= recaptcha_tags %> in my view, it prints this on the page: <script type="text/javascript" src="http://api.recaptcha.net/challenge?k=my_key&amp;error=expression"&gt;&lt;/script&gt; <noscript> <iframe src="http://api.recaptcha.net/noscript?k=my_ot...

Labeled fixtures for associations in Rails 3 broken

After upgrading to Rails 3, fixtures that refer to other labelled fixtures (for relationships) stop working. Instead of finding the actual fixture with that name, the fixture label is interpreted as a string. Example: # Dog.yml sparky: name: Sparky owner: john # Person.yml john: name: John Where Dog "belongs to" person. The...

Rails 2.3.4 Vs Rails 3 + Book - Beginner in RoR

Hi, I have started with Ruby and Rails development and I am a Java developer from the last 2 years (student). I am in for two things: Learn Ruby Make my website on ROR I have Agile Web Development with Rails, 2nd Edition. So, here are my questions: How is the Agile Web Development with Rails book to start with, where I don't know...

Sqlite3 error after Rails 3 (beta 4) install

After Installing Rails 3, I get the following error regarding Sqlite3 when I try to do a migrate: dlsym(0x1037e5f10, Init_sqlite3_native): symbol not found - /Library/Ruby/Gems/1.8/gems/sqlite3-ruby-1.3.0/lib/sqlite3/sqlite3_native.bundle I am using Snow Leopard, if that makes a difference. ...

Display a flash message for a specific loggedin user upon receiving request.

Dears, how can i trigger a prompt (or flash message with links) display (notifying) for one of the logged in agent (specific agent screen) on my web application when receiving a request from a client. using rails and jquery. as my application is serving a call center, and the my client request ... when a call coming to the system a pro...

Formtastic nested model form fields (Rails 3)

So here's the scenario: User: has_one :company accepts_nested_attributes_for :company Controller: @user = User.new @user.build_company View: <% semantic_form_for @user, :url => register_path do |form| %> <h2>User Information</h2> <%= form.inputs %> <h2>Company Information</h2> <% form.semantic_fields_for :company do ...

Rails 3 equivalent of complex SQL query

Given the following models: class Recipe < ActiveRecord::Base has_many :recipe_ingredients has_many :ingredients, :through => :recipe_ingredients end class RecipeIngredient < ActiveRecord::Base belongs_to :recipe belongs_to :ingredient end class Ingredient < ActiveRecord::Base end How can I perform the following SQL query us...

jQuery AJAX request (Rails 3) gets redirected and returns empty message body (only with SSL)!

I'm trying to do a manual jQuery AJAX request the following way: $("#user_plan_id").change(function() { $("#plan_container").load('/plans/' + this.value); }); I have the "rails.js" file included in my header, and a "<%= csrf_meta_tag %>". I see from my log that the request IS getting to the server (although without the authentici...

Adding custom :new routes using Rails 3 routing

In Rails 2 we can add custom new actions to resourceful routes, like: map.resources :users, :new => {:apply => :get} How do we achieve the same thing in Rails 3? resources :users do get :apply, :on => :new # does not work new do get :apply # also does not work end end Any ideas? ...

Rails 3 Authenticity Token

Does anyone know how the authenticity token is managed in rails 3? With all the unobtrusive javascript rails 3 articles showing how the html5 data attributes are used I don't see the authenticity token anywhere. ...

Custom Validations Error in Rails 3 beta4

I keep getting an error from the ActiveModel:EachValidator module when I try to use it as follows: class AnswerValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record.errors[attribute] << (options[:message] || "question not answered") if value.nil? and !record.errors[attribute].include?(options[:m...

How do I include Responder in ActionController::Metal in Rails 3?

I'm working a Rails 3 controller that has a very specific, limited purpose, and all I need is for it to respond_to :json. This screencast says my controller can inherit from ActionController::Metal, and then just include the functionality I need to make things faster: http://rubyonrails.org/screencasts/rails3/action-controller When my...

With Rails 3 routes, how do you only allow a requests from 127.0.0.1?

I'm writing an app where several of the routes should only be accessible from localhost. It looks like this is possible with the new routing system. http://www.railsdispatch.com/posts/rails-3-makes-life-better This has examples of restricting routes based on IP address, and setting up an IP address blacklist for your routes, but I'm in...