Relationships with class_name

0 views
Skip to first unread message

toby hede

unread,
Jul 17, 2008, 6:05:48 AM7/17/08
to Streamlined
Hi,
I've been using Streamlined and *loving* it.

One thing I have struggled with is getting Relationships to work where
I am using the ability of ActiveRecord to map a column to a different
class.

Contractor:
belongs_to :job_size_minimum, :class_name =>
"ProjectSize", :foreign_key => "job_size_minimum"
belongs_to :job_size_maximum, :class_name =>
"ProjectSize", :foreign_key => "job_size_maximum"

ContractorUI (in controller)
:job_size_minimum, {:enumeration =>
Contractor::PROJECT_SIZES_HASH.sort {|a,b|
a[1]<=>b[1]}, :unassigned_value => "" },
:job_size_maximum, {:enumeration =>
Contractor::PROJECT_SIZES_HASH.sort {|a,b|
a[1]<=>b[1]}, :unassigned_value => "" },


I managed to do some hacketry with enumerations and
before_streamlined_ filters to map the value to the associated Model,
but it's not pretty.

Basically, is there something I am missing?

I am happy to patch, any pointers on what I would need to do for this?

Matthew Bass

unread,
Jul 23, 2008, 8:41:23 PM7/23/08
to strea...@googlegroups.com
No, I don't think you're missing anything Toby. There are still rough edges to Streamlined, especially when dealing with non-typical uses of Rails (complex associations and whatnot).

 
Instructions for submitting patches are available here:

 
We appreciate contributions.

 
Matthew
Reply all
Reply to author
Forward
0 new messages