ruby-on-rails

What's the difference between request.env['REQUEST_URI'] and request.env['REQUEST_PATH']?

What's the difference between request.env['REQUEST_URI'] and request.env['REQUEST_PATH'] in Rails? They always seem to contain the same value. ...

Best way to get all my users onto the same domain?

I have about 10 domains pointing to my Heroku app (it took forever to settle on a name for the site -- don't ask), all of which I've given to various people at various times. Now that I've decided on a domain name (call it "example.com"), I want the existing domains to all work, but to redirect to example.com. What's the best way to do ...

saving to join model has_many :through

Sequences are acting as a join table between procedures and steps: create_table "procedures", :force => true do |t| t.integer "procedure_id" t.integer "revision" t.string "description" end create_table "sequences", :force => true do |t| t.integer "procedure_id" t.integer "step_id" t.integer "step_nu...

Posted XML attributes dropped by Rails?

echo '<request><item attribute="foo">bar</item></request>' | curl -X POST -H 'Content-type: application/xml' -d @- http://10.0.1.51:3000/baz/evaluate My Rails application forgets all about the attribute when it receives the posted XML. Processing BazController#evaluate (for 10.0.1.3 at 2009-10-03 18:29:32) [POST] Parameters: {"reque...

Where to patch Rails ActiveRecord::find() to first check collections in memory?

For somewhat complicated reasons, I would like to create something that works like this: # Controller: @comments = @page.comments # comments are threaded # child comments still belong to @page ... # View: @comments.each_root { display @comment { indent & recurse on @comment.children } } # alternatives for how recursion call m...

OnChange problem with select_tag with '/' and '.' characters in Rails

I have an select_tag (rails) that loaded a select value with '/' and '.' character in it. The select tag's onchange redirects the page (using window.location) using concatenated url with the value of the select tag. These are the things I tried to isolate the problem. Invokes alert javascript to show the concatenated value. Added url...

Why doesn't this simple Rails migration update my database?

I've got a very simple migration that adds a single boolean column: class AddMuteToPreferences < ActiveRecord::Migration def self.up add_column :preferences, :mute_audio, :boolean, :default => false end def self.down remove_column :preferences, :mute_audio end end I run the migration: == 81 AddMuteToPreferences: migr...

Looking for a simple rails hosting with a rails philosophy

Hello. I'm starting to develop applications using rails, I am designer turning developer. I have not find yet a rails hosting easy to use. I tried mediatemple and their RoR container, seems very easy in the control panel: just press a button and you have your application running. But they dont have sqlite3, changed to mySQL and I stil...

How can I access an Interbase (.IB) database using RubyOnRails?

I have a database in Interbase and I want to access it directly from my Rails app using ActiveRecord. How can I do it? ...

ORM that accepts SQL and simply maps the objects and relations?

I find that the use of ActiveRecord affects the way I design the database schema (though I wish it wouldn't). I'm thinking about the inefficiency of fetching data and how to reduce the overall number of queries. The find :include option can only get you so far. I come from writing stored procs that grab everything you need (for a part...

Redirect on record not found?

On the book Agile Web development with Rails, it is proposed that when someone tries to access some data in your web site and the record doesn't exist anymore, that the user should be redirected to a working page and display a message. A user would go to /book/1, but a book with id 1 doesn't exist anymore, so it is redirected to /books...

Views with Multiple Admin-ish Roles

I have an app where there are multiple "Admin-ish" roles. Imagine you have a super-admin that can edit anything, and also a site-admin that can edit any information about his site. So both admin/sites and siteadmin/sites are basically the exact same view. What's the right way to set this up (views/controllers)? I'm trying to keep thing...

Sorting page flow for has_many in Rails

I have a page flow allowing the user to choose an object ("Player") to add to a has_many :players association in another model. 1 => List existing players for object [Enter player name] 2 => List of matching players [Select player] 3 => Confirmation page [Press 'Add'] 4 => Done I want users to be able to choose "New Player" inst...

Why is Capistrano not checking out the latest version of my code from SVN?

I'm using Capistrano and Rails 2.3.4. I've already done a deploy:cold to the remote server. Now on my local box I changed a layout file and committed it to the repository (I am using Netbeans 6 as my IDE). I type cap deploy and Capistrano runs through it's commands and tells me that it's checked out and deployed the most recent versio...

Implementing page controller all over rails

Hi All. I seem to have got a little a head of myself. I have created a Page Model and Pages controller. The whole idea was to be able to call something like 'print :controller=>'Pages', :action=>'view', :id=>'6', :layout=>'none'' And in my application.html.erb I have a div with yield, and in the next div I would like to have the above...

Guideline for code examples in job applications

Very often in job offers one is asked to provide some 'example code' together with the CV. I found it kind of difficult do decide which code is a good choice. Of cause it has to be meaningful code but on the other hand short enough to get a quick overview. It has to be well-documentated but not filled up with messy comments. Okay, sure...

web based ide for ruby on rails?

Does a web based IDE exist for ruby on rails development? ...

[Rails] Routing: resource_path or resource_url?

When you do map.resources on a model, it generates a bunch of routing helpers: resource_path(@resource) resource_url(@resource) new_resource_url etc. What's the difference between using _path and _url? From what I've tried it doesn't seem to make any difference. ...

Why do migrations need the table block param?

Why does the ruby on rails migration syntax look like this: create_table :my_table do |t| t.integer :col t.integer :col2 t.integer :col3 end And not: create_table :my_table do integer :col integer :col2 integer :col3 end Personally I find the second snippet much more readable, are there any reasons w...

Row based Time Zones in Rails 2.3.4

What is the best way to handle the following situation: We have "admins" who create "events". These events can be nationwide, ie: different time zones. As of now there is a select menu with the current list of US time zones. There is a corresponding column in the database table, for the time zone selected. This is so the admin can selec...