ruby-on-rails

Does the jquery load method provide ajax functionality equivalent to the Rails replace_html method?

The jquery load method loads HTML from a remote file and injects it into the DOM. For example, to load the feeds.html file into the div with the ID of feeds, you would do this: $("#feeds").load("feeds.html"); Is this an alternative to calling a partial with the Rails replace_html method or is the functionality slightly different? pag...

Send emails (using Postfix) from two different domains.

Hi, I have two Ruby on Rails applications, and two virtual domains (mydomain1.com and mydomain2.com)(using Apache+REE+mod_rails). I use Postfix as mail server. So I have myhostname = mail.mydomain1.com in main.cf And that's because why the sender is always mail.mydomain1.com, no matter from which application I send emails. I need all ...

Which editors are recommended for writing Ruby or Ruby on Rails code?

I'm interested in learning ruby. But the most important thing for me is, if there are any good editors for that. That will help me decide if it's worth to switch from PHP to Ruby. ...

Rails/ActiveRecord: save changes to a model's associated collections

Do I have to save modifications to individual items in a collection for a model, or is there a method I can call to save them when I save the model. #save doesn't seem to do it. For example: irb> rental = #... #=> #<Rental id: 18737, customer_id: 61, dvd_id: 3252, date_rented: "2008-12-16 05:00:00", date_shipped: "2008-12-16 05:00:00"...

Ruby on Rails, ActiveScaffold and relatives in database

I have 2 tables: form, questions. Idea is very easy, every form have many question. Tables were maded form = | id | title | questions = | id | title | input | form_id | and how you can guess the form_id is key of form id. class FormsController < ApplicationController active_scaffold :form end class QuestionsController < Applicatio...

how do you make it so that www.site.com/123 or www.site.com/123/some-headline will both lead users to the same place which is www.site.com/123 ?

how do you make it so that www.site.com/123 or www.site.com/123/some-headline www.site.com/123/anything-at-all will lead users to the same place which is www.site.com/123 ? I think the routing in Ruby on Rails can do it. But other than that, what other methods can do that. can it be done by Apache alone? ...

How do you prefer to organize your test data in Ruby On Rails?

How do you prefer to organize your test data in Ruby On Rails: fixtures, object factories or anything else? Why? ...

Rails Deployment on Win32 Best Practices: Lighty + Sgci

I've received some really great guidance from users of this site, and I'm thinking some advanced Rails people could assist me in resolving the following problem. I'm attempting to deploy a simple Rails application on a win32 server. I've been carefully working through these instructions (see http://functionalelegant.blogspot.com/2008/0...

Using Git to track Ruby on rails

Other than the database and log files are there any other files that should not be in the repository for security reasons? The project will mostly be worked on by myself however the code is to be stored on a shared repository which will be available to a few other users should they want to pull from it. The project is reasonably simple...

Setup a Capistrano task to only run on deploy, not deploy:cold

I am using craken to run cron processes on my aws machine instance. I have defined the following custom tasks in Capistrano: namespace :craken do desc "Install raketab" task :install, :roles => :cron do set :rails_env, "production" unless exists?(:rails_env) set :env_args, (exists?(:env_args) ? env_args : "app_name=#{applica...

Should raise_delivery_errors be set to true in a production Rails app?

The default in Ruby on Rails is to have this set to false (in production and development). config.action_mailer.raise_delivery_errors = false Seems strange. I'm definitely turning it on in development which has been helpful. But why does no one seem to have this turned on in production? Shouldn't we want to get notified if an email...

ActiveRecord and SELECT AS SQL statements

Hi all, I am developing in Rails an app where I would like to rank a list of users based on their current points. The table looks like this: user_id:string, points:integer. Since I can't figure out how to do this "The Rails Way", I've written the following SQL code: self.find_by_sql ['SELECT t1.user_id, t1.points, COUNT(t2.points) as u...

Installation problem of Ruby on Rails

I am beginner of Ruby on Rails and use Windows for development. I do the following steps: 1. Download Ruby v.1.9.1 ftp://ftp.ruby-lang.org/pub/ruby/binaries/mswin32/ruby-1.9.1-p0-i386-mswin32.zip Extract it and put it into C:\ruby 2. Download the latest Aptana and install it 3. Install the RadRail plugin in Aptana. 4. Set the ruby path ...

How do I use ActiveResource with a custom URL scheme?

I'm trying to create ActiveResource objects for three objects in an internal application. There are Tags, Taggings, and Taggables: http://tagservice/tags/:tag http://tagservice/taggings/:id http://tagservice/taggables/:type/:key Tag's :tag is the URL-encoded literal tag text. Tagging's :id is an autoincremented integer. Taggable's ...

Modify existing files with a rails generator?

I'm writing a generator that adds a few files that my server will use. I'd also like to add a line to the environment.rb file. Can this be done with a generator or should I be using an app template? ...

What is the benefit for freeze gems in Ruby on Rails?

Same as Title said: What is the benefit for freeze gems in Ruby on Rails? ...

Why use a web framework (like rails) over php?

This isn't a question about what framework to use. I've learned both Rails and Django, and I write all of my webapps in PHP. My question is why bother with the frameworks? It's always taken me longer to use a framework than to reuse old MySQL code and build "models" with phpMyAdmin. I also like writing everything myself, because I know w...

nginx not setting expires headers on Rails static assets

I can't seem to get nginx to set expires headers on my static assets in my Rails app. My app is deployed using Phusion Passenger & nginx. Below is the related section of my nginx config file server { listen 80; server_name my.domain.tld; root /home/deploy/my.domain.tld/current/public; passenger_enabled...

Using session data to find out who's online

I want to be able to find out who is logged into my web app and be able to print out a list of logged on users. I also want to be able to print out who is viewing a certain section of a the app (for example the chatroom, so I can print out the chat users). At the moment, I just have: session[:role_id] = @role_id when someone logs in...

Keeping page breaks from form input

In my Rails app, I want to keep the \n that are inputted in the forms. What I've done so far is output with simple_format(). But the problem is that simple_format wraps the text in < p >< /p > if there is a \n. This is problematic for my chatroom log as I don't want each message to appear in a new paragraph. What should I do instead? ...