ruby-on-rails

rails update question: where are the new files?

Some time ago I updated my app from Rails 1.2 to 2.3. The upgrade definitely worked (was in pagination hell for a while), and the app has been working fine. But now I'm in the process of upgrading my app for mobile use and want to use the Mobile Fu plugin. However, that calls for changing the mime_types.rb file... and I don't have that...

Rails model: "has many" *simple* attribute

Let's assume this model: Movie - Title: String - Has many: - Alternative Title: String My questions is, how should I store the alt. title attribute? I am deciding between three approaches: Separate AR model: probably an overkill CSV in a signle DB column Serialized array in single DB column The latter two seems logically equi...

which is the most popular Ruby on Rails AUTHORIZATION gem/plugin at the moment?

Hi, Which is the most popular Ruby on Rails AUTHORIZATION gem/plugin at the moment? (I am using AuthLogic for authentication by the way) Thanks ...

How does rendering different formats/layouts in Rails affect SEO?

I have been reading a lot about cloaking and redirects, and am wondering how this fits into rendering and layouts in Rails... Two parts: 1) If I have different data formats to render in (json, xml, html, and iphone), and they all use the same url, differing by the ".format" at the end, is this considered "content duplication"? It seem...

Ruby on Rails :before_filter => :only_when_user_is_logged_in

Using Ruby on Rails, I want to before filter an action but only when users are logged in. How is this possible? ...

many instances of apache get spawned with Passenger/Rails

Hello, I have a Debian Linux VPS server for my production website (512MB). I'm using Phusion Passenger with Apache to service my Rails 2.3.4 application with Ruby 1.9. I'm limiting the pool of Phusion passenger instances to 3 Although the traffic is relatively low, the server crashes at times and I notice (when using 'top' command) t...

I keep getting QUIT and CONNECT HTTP methods sent to my server, what do they mean?

I keep getting the two following errors from my server, I assumed they were just bots looking for potential targets, but does anyone know specifically why I'm getting these? I'm using the SslRequirement plugin to make sure all hits to the login/signup page are redirected to SSL, so all of these weird https requests to root should just b...

Question about Ruby on Rails, Constants, belongs_to & Database Optimization/Performance

I've developed a web based point of sale system for one of my clients in Ruby on Rails with MySQL backend. These guys are growing so fast that they are ringing close to 10,000 transactions per day corporate-wide. For this question, I will use the transactions table as an example. Currently, I store the transactions.status as a string ...

How to call a model method immediately after my application loads in Ruby on Rails

How do I call a models method just after my application loads. This sets up some of the business rules in my application and I want to run this method every time my server is restarted or changes have been made to my production. What would be the best way to do this ...

Simple Ruby on Rails tutorial

Can somebody give link to RoR's "hello world" ? Where writen how RoR works with simple example? thanks. ...

Is it possible for rails to save multiple data type in same db column ?

I tried to simulate variable_set and variable_get in drupal which use as site-wide variables storage. I tried something like this. # == Schema Information # Schema version: 20091212170012 # # Table name: variables # # id :integer not null, primary key # name :string(255) # value :text # created_at :datetim...

Rails: How can I access the parent model of a new record's nested associations?

Suppose we have the standard Post & Comment models, with Post having accepts_nested_attributes_for :commments and :autosave => true set. We can create a new post together with some new comments, e.g.: @post = Post.new :subject => 'foo' @post.comments.build :text => 'bar' @post.comments.first # returns the new comment 'bar' @post.commen...

Your radiant deployment recipe.

Are you using Radiant CMS? If yes, what is you deployment strategy? Since lot's of configuration is stored in the database, I need to overwrite db on the server with my development db (with capistrano it is not a problem). But this will work only if I am the only one who updates the website. And what if customer in a meanwhile has crea...

Does RackSpace have a read-write file system?

I deployed a Ruby on Rails app to Heroku, and I realized they have a read-only file system (http://docs.heroku.com/constraints#read-only-filesystem). This means I can't cache images locally, for example. I was using a Ruby gem called "Rio" (Ruby Input/Output), and that let me save files to my /public/images directory. Are there any go...

How can I force 'www' subdomain w/ Apache2 + Rails + Phusion Passenger?

My clients want to use 301 redirects to force the 'www' subdomain on their sites. So 'example.com/something' resolves to 'www.example.com/somthing' etc. What I'm trying to do is simply add this to my vhost file: <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName example.com ServerAlias www.* DocumentRoot /data/...

Which version of rails for a new project?

I'll start in the beginning of the next year (2010) a big new project with Rails. Can somebody give me advice which version of Rails I should use and why? ...

Cascade delete in Ruby ActiveRecord models?

I was following the screencast on rubyonrails.org (creating the blog). I have following models: comment.rb class Comment < ActiveRecord::Base belongs_to :post validates_presence_of :body # I added this end post.rb class Post < ActiveRecord::Base validates_presence_of :body, :title has_many :comments end Relations ...

Good code sample in rails

I have been developing in rails for the past 1.5 years .. however , I feel my code is not upto the mark , and I still dont fully utilize all that Ruby and Rails have to offer . I have gone through all the material that is available on the guide site , and have incorporated that in my code . However , every time I see someone else's code ...

What does the "$" character mean in Ruby?

Been playing with Ruby on Rails for awhile and decided to take a look through the actual source. Grabbed the repo from GitHub and started looking around. Came across some code that I am not sure what it does or what it references. Can anyone tell me what the dollar sign ($) character does in Ruby? I saw this code in actionmailer/test/ab...

(Ruby on Rails) Page header going as text/javascript, when it is not supposed to

Im developing an Rails application, but I found a problem when accessing it with internet explorer. Firefox and Safari displays the pages all right. Althrough, when using internet explorer, in some pages it tries to download the page, instead of displaying it. I have no idea what could be happening. Here is the html header of my applica...