Forum: Ruby on Rails RoR Developer Needed

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Larry Staton Jr. (Guest)
on 2006-06-12 17:13
(Received via mailing list)
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 removed_email_address@domain.invalid.
David Andersen (Guest)
on 2006-06-13 01:04
(Received via mailing list)
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.
Dave D. (Guest)
on 2006-07-19 07:21
(Received via mailing list)
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 %>
  <tr class='altRow'>
    <td><%=h customer.name %></td>
    <td align='left' colspan='5' >&nbsp;</td>
    <td>&nbsp;</td>
    <td><%= link_to 'Show', :action => 'show', :id => customer %></td>
    <td><%= link_to 'Delete', { :action => 'destroy', :id => customer },
:confirm => 'Are you sure?', :post => true %></td>
  </tr>
<%  for addr in customer.addresses.collect  %>
  <tr>
    <td>&nbsp;</td>
    <td><%=h addr.street %></td>
    <td><%=h addr.city %></td>
  </tr>
<%
    end
    end
%>

Hope this helps!
Dave
Nicholas H. (Guest)
on 2008-12-18 15:59
(Received via mailing list)
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.
This topic is locked and can not be replied to.