ruby-on-rails

What are the advantages of using Passenger over a Mongrel Cluster?

Hi, This is probably the silliest question today but... The Rails team & many others recommend using passenger instead of a mongrel cluster, but I cannot find a clear list of exact benefits / advantages of this or what the potential pitfall are. Just wondering if anyone can help explain this? Also is passenger its own server or does i...

Rails ActiveRecord - inheriting from a base class with no table

What i'm looking to do is have a base class for some of my models that has some default activerecord behavior: class Option < ActiveRecord::Base has_many :products def some_method #stuff end #etc..etc.. end class ColorOption < Option #stuff... end class FabricOption < Option #stuff... end However, I want ColorOpti...

Should I use Ruby 1.9.2 with my new web app?

Starting a new web app with Rails 3. I'm still relatively new to web development and have really enjoyed all the internet resources available to me while working in Ruby 1.8.7 and Rails 2.3.5. Any advice against using Ruby 1.9.2 on my new project? ...

How to automatically set all links to nofollow in Rails

I know I can pass :rel => "nofollow" to link_to but is there a way to set that by default so I don't have to make changes in each link_to tag? ...

statistics from models created

I'm trying to figure out an efficient way to provide data to a plotting script jqplot of the amounts of clicks on a certain model I have the main model: Listing has_many clicks each click has a datestamp how can I get a count of clicks created for each day in a date range? ...

Bind action mailer smtp setting from model.

Right now i have set my all smtp setting in environment.rb file. I have stored my all setting in database. I want to bind smtp setting from my model. How may i dynamically bind those settings from model ? ...

I am getting a "patient successfully updated" message after updating a object but values stay the same in rails?

Hi Sorry i really didn't know how to phrase the question any better but here is my problem: when i try to update or create a patient object in my rails application the values are not getting sent through to the model, because when i try to create a new patient i get validation errors that i put in place sating i have to enter values (w...

Rails 3 routing - passing params from routes.rb

In rails 2.3.5 you could do something like this inside the routes.rb file: map.root :controller => "pages", :action => "show", :id => 3 In rails 3 I haven't found any way to pass a specific parameter (like in rails 2.3.5 with :id => 3). I know I can handle it from the controller and have the same result (which I did), but I was wond...

How to change filename prompt text browser Save As dialog?

Hello, In my web page (rendered by Rails), I'd like to let the user right-click on a photo to bring up the browser's Save As dialog, to let the user save the photo to their hard drive. However, the photos on my server have unusual filenames (long hex names) with no file extension. The filename prompt in the Save As dialog has this ugly...

fields_for, formtastic, ActiveMerchant, and validation errors

I'm trying to use Formtastic to create a payment form, since I'd like to use the inline errors. I'm using ActiveMerchant to handle the billing. I have the following form: <%= semantic_form_for @payment do %> <%= form.inputs do %> <%= form.input :email, :label => "Email Address" %> <%= form.semantic_fields_for :credit_card_at...

RoR: fields_for and partials.

hi, i am using nested_attributes for an association of products back to a transaction. I need to add a date to the products model. I would like to add a link to set the date_select to today. here is the view: <% f.fields_for :trans_products do |builder| %> <%= render 'trans_product_fields', :f => builder %> ...

S3::Error::NoSuchKey: The specified key does not exist.

Im getting this error when I try and make an object. Here is my routine: service = S3::Service.new( :access_key_id => S3_ACCESS_KEY, :secret_access_key => S3_SECRET ) puts "connection established with s3" puts "finding bucket" bucket = service.buckets.find("test") puts "building object" object = bucket.objects.build("jso...

Google Checkout Buy Now Buttons w/ Google Doc Forms

I have a Google Checkout account and have been using it to sign up for classes. I currently just use a Buy Now button but would like to grab more information about the user than simply an email address and credit card information. Is there a way to integrate Google Checkout Buy Now Buttons with Google Doc Forms? I'm trying to find a ...

How do i define a second environment.rb file in rails?

My default environment.rb is overflowing, and i would like to have a separate file that works exactly the same way. How can I do so? ...

Heroku upload changes

Hi! I make some changes in local files, how can I deploy the new version? if I type git push heroku master, it's say everything up to date, but the application wasn't changed. ...

S3::Error::SignatureDoesNotMatch: when I try and save a new object

this is coming up on my save, not when I try and sign in. Here is my code: service = S3::Service.new( :access_key_id => S3_ACCESS_KEY, :secret_access_key => S3_SECRET ) puts "connection established with s3" puts "finding bucket" bucket = service.buckets.find("") puts "building object" object = bucket.objects.build("#{RAIL...

ruby integer to boolean

Hello all, I have a DB field that is integer type and values are always 0 or 1. How do I grab the equivalent boolean value in ruby? such that when i do the following the check box is set appropriately: <%= check_box_tag 'resend', @system_config.resend %> ...

Heroku takes care of multiple database servers?

When my user base grows, does Heroku take care of setting up multiple database servers for my Rails app or do I have to configure it manually somehow? In other words, does Heroku scale well and correctly (replicate servers) when needed? ...

How to turn off generators for RSpec 2 in Rails 3?

I installed the current RSpec 2 Beta under Rails 3 RC as mentioned on the GitHub page (and several blogs). Everything works fine, but I am not able to turn off specific generators like advised on some blogs. Here is what I do in ./config/application.rb: config.generators do |g| g.test_framework :rspec, :fixtures => false, :views => f...

Rails generate scaffold user:string password: string just creates a new rails folder

I'm new to rails and trying to follow along with railstutorial.org. When I use Rails generate scaffold user:string password:string, it creates a new folder entitled generate and does the same command as "Rails Demo_App". I'm assuming I don't have something installed correctly. I'm using Windows 7, Cygwin/Vim/Sqlite3 - I have neede...