RoR Developer Needed

Our law firm is looking for a contractor to assist in developing and
extending our internal case management system. This system tracks
most aspects of our workflow. Our current system is deployed as a
WebObjects application and would need to be rewritten in Ruby on
Rails. We need a dedicated person(s) to help us rewrite the system
and drive future development.

Applicants must have at least 2 years of prior web application
development experience with demonstratable Ruby on Rails skills.
Applicants must also have experience with relational database
systems, preferably OpenBase. The current Web application uses
OpenBase, but we are willing to switch to PostgreSQL. A strong
commitment to Web standards and quality, test-driven code is a huge
plus as is the ability to design intuitive applications.

Our case management system is deployed on a Apple XServe running Mac
OS X Server.

We are looking to hire immediately. If you are interested in
applying, feel free to send an e-mail to [email protected].

Hey, i’m trying to iterate over the grouped results of a :group
statement,

for example, like a city, has_many :buildings, :group => “neighbourhood”

or @city.buildings.find(:group => “neighbourhood_id”)

or even if i were to grab it straight from sql,

how do i iterate over the result ?

i thought maybe it would be key value, key being the neighbourhood id
and value being the collection, however that didnt seem to work for me.

what i would like accomplish is being able to display the of buildings
for each neighbourhood.

any ideas ?

thanks,

d.

Hi David,

Collections should work in a has_many relationship. In my example below,
the
Customer model has_many :addresses
Addresses are of the Array class

class Customer < ActiveRecord::Base
has_many :addresses
end

Customer and Address tables might look something like:

create_table “customers” do |t|
t.column “number”, :string, :limit => 50
t.column “name”, :string, :default => “”, :null => false
end

create_table “addresses” do |t|
t.column “customer_id”, :integer, :default => 0, :null => false
t.column “street”, :string, :default => “”, :null => false
t.column “city”, :string, :default => “”, :null => false
end

Some data:

insert into customers values
(1, ‘10001’, ‘AAA Cooper’),
(2, ‘10002’, ‘Absolute’);

insert into addresses values
(1, 1, ‘1751 Kinsey Road’, ‘Vancouver’),
(2, 1, ‘101-11312-98 Avenue’, ‘Grande Prairie’),
(3, 2, ‘800 Cabin Hill Dr’, ‘Greensburg’),

Console testing:

ruby script\console

c=Customer.find(1)
=> #<Customer:0x39251f0 @attributes={“name”=>“AAA Cooper”,
“number”=>“10001”, “id”=>“1”, “address_id”=>“1”}>

c.addresses.size
2

c.addresses[0].city
Vancouver

c.addresses.each {|x| p x.city}
Vancouver
Grand Prairie

I use collect in my rhtml templates like so:

<% for customer in @customers %>

<%=h customer.name %>     <%= link_to 'Show', :action => 'show', :id => customer %> <%= link_to 'Delete', { :action => 'destroy', :id => customer }, :confirm => 'Are you sure?', :post => true %> <% for addr in customer.addresses.collect %>   <%=h addr.street %> <%=h addr.city %> <% end end %>

Hope this helps!
Dave

Ok, found it:

http://wiki.radiantcms.org/Conditional_tags

The header tag is what I needed.

Cheers,
Nicholas

On Wed, Dec 17, 2008 at 2:14 PM, Nicholas H.