Different controllers placement

request: /blog
controller placed at /app/controllers/test/blog_controller.rb:

class Test::BlogController < ApplicationController
def index
render :text => ‘Hello, World!’
end
end

What the write map.connect shoud I use? Any Idias?

I see that map.connect ‘/blog’, :controller => ‘test/blog’ working
correctly, but what about more complex example such a map.connect
':controller/:action/:id?

On Dec 8, 2005, at 3:31 PM, Timur wrote:

I see that map.connect ‘/blog’, :controller => ‘test/blog’ working
correctly, but what about more complex example such a map.connect
':controller/:action/:id?

You can find examples here:
http://typo.leetsoft.com/trac/file/trunk/config/routes.rb

Routes are pretty easy to grasp. There is a tutorial floating around
somewhere too. You could always join #rubyonrails for more support.

  • Warren

On Thu, 8 Dec 2005, Phil S. wrote:

Addresses[0].attributes.keys returns the columns, but not in the selected
order

Addresses.column_names returns the column in alphabetical order.

Any suggestions?

columns = %w( name street city state zip )

sql = <<-sql

 select #{ columns.join ', ' }

 from addresses

sql

addresses = address.find_by_sql sql

csv = CSV::Writer::new ‘somefile.csv’

csv << columns # add header

addresses.each do |address|
row = columns.map{|col| address.send col}
csv << row
end

hth.

-a

===============================================================================
| ara [dot] t [dot] howard [at] noaa [dot] gov
| all happiness comes from the desire for others to be happy. all misery
| comes from the desire for oneself to be happy.
| – bodhicaryavatara

I have written some reporting queries using Active Record such as:

addresses = address.find_by_sql(“select name, street, city, state, zip
from
address”)
The queries are actually much more complex than this with aggregation,
joins, etc… that’s why I’m using the find_by_sql method.

I am converting the output of my report queries to CSV… unfortunately
I
can’t figure out a generic way to get the report queries to preserve the
column order (name, stree, city, zip)

Addresses[0].attributes.keys returns the columns, but not in the
selected
order

Addresses.column_names returns the column in alphabetical order.

Any suggestions?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs