[Rails] Re: dynamic table names for AR models

2009-05-13 Thread Pete Hodgson
Marnen Laibow-Koser wrote: > > Why not create a "wheels" view which combines the data from all the > "wheels_for_*" tables, then tie your Wheel model to that? > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > mar...@marnen.org I think that would have some performance issues. If t

[Rails] Re: dynamic table names for AR models

2009-05-13 Thread Pete Hodgson
Gabriel Saravia wrote: >> but for some reason that doesn't quite feel like a good solution. > > that, overall, makes sense, and is very little code..combine it with a > before callback or method_missing? > > what about it seems like a poor solution? > > I come back to asking, will all wheel cl

[Rails] Re: dynamic table names for AR models

2009-05-12 Thread Pete Hodgson
Gabriel Saravia wrote: >> The names of the various Wheel tables are not known at design >> time. > > well..if this is the case, i don't see how you're really going to keep > from some form of dynamic creation/metaprogramming/code generation and > also keep the design clean... > I guess the b

[Rails] Re: dynamic table names for AR models

2009-05-12 Thread Pete Hodgson
Gabriel Saravia wrote: > > > Wheel < ActiveRecord::Base > self.abstract_class = true > > CarToWheelsClassHash = {:ford => "FordWheel"} > > def self.abstract_find(car_brand, *normalfindargs) > CarToWheelsClassHash[car_brand].constantize.find(*normalfindargs) > end > > [other code

[Rails] dynamic table names for AR models

2009-05-12 Thread Pete Hodgson
Hi All, I have an interesting Active Record problem and I'm not quite sure what the cleanest solution is. The legacy database that I am integrating with has a strange wrinkle in its schema where one logical table has been 'partitioned' into several physical tables. Each table has the same structu

[Rails] Re: RESTful routing: allowing .s [dots] in ids

2008-12-09 Thread Pete Hodgson
Lee Fyock wrote: > See <http://dev.rubyonrails.org/ticket/6426>. > > One solution is to add > module ActionController::Routing > SEPARATORS = %w( / ; , ? ) > end > in your controller. I'm not sure if this still works under recent > versions of Rails. >

[Rails] Re: RESTful routing: allowing .s [dots] in ids

2008-12-09 Thread Pete Hodgson
Philip Hallstrom wrote: > I haven't tried it with a restful route, but I have a route like this: > > r.curriculum '/curriculum/:code/:title/:action', > :defaults => { :action => 'overview' }, > :requirements => { :code => %r([\d.]+) } > > :code is a float

[Rails] RESTful routing: allowing .s [dots] in ids

2008-12-09 Thread Pete Hodgson
Hi Folks, I'm trying to set up a RESTful route in my rails app and have hit a snag. My application allows various different types of querying centered around a search phrase, and I decided it'd be nice to that in my RESTful API by exposing resources like: http://www.myapp.com/api/keyword_researc