On Tuesday, October 12, 2010 08:51:21 pm Dave Howell wrote:
> On Oct 8, 2010, at 0:12 , David Masover wrote:
> > What limitations? I'm curious.
> 
> I think mostly I would go to the template, and then discover that I'd need
> some logic to get it to come out right, so I'd mix that in (which really
> clutters things up), and then I'd realize I needed to loop it, and so I'd
> move that whole chunk back to the controller.

Except Haml has looping constructs. There's also a pretty neat idiom where you 
call a partial from a loop, so you keep your templates small. Unless your 
loops are particularly bizarre, you'd still be looping over something that 
came from your controller, so I don't think it's too much code in your 
templates. Even if it was, I certainly don't see how abandoning the idea of 
separating logic from presentation wholesale is better.

> The deal-breaker came when I
> found it was apparently impossible to emit HAML *from the controller* and
> have it processed.

I'm pretty sure that's not true, though it's probably a bad idea and the code 
would likely be ugly.

> > And, did you try Erector, or something similar? I prefer Haml, but if I
> > was finding it "limiting", I think that's where I'd go next.
> 
> I didn't find Erector when I was looking. It was mentioned to me recently,
> and look at first glance rather a lot like what I built for myself, so I
> intend to give it a very close look sometime soon.

It's basically a next-generation Markaby, and I'm guessing that existed when 
you were looking. Ah, well...

> >> I then spent yet another whole day trying to get Rails to work. I'd
> >> heard such glowing praise for Rails that it took me that long to
> >> realize that it was utterly unsuitable for my web app.
> > 
> > Again, I'm curious -- both about what the app was, and when this was.
> > Rails has come a long way.
> 
> It's a program for a pharmaceutical company to track their products,
> processing, and inventory. My PostgreSQL schema uses a custom data type
> ('percentage' which is a numeric(5,2) that cannot be set above 100.00 or
> below 0.00),

Huh. DataMapper does support custom, user-defined types, though I'm not sure 
how easy it is to do that with an existing adapter. (To give you an idea, 
there is currently a working DataMapper adapter for Google App Engine.)

> uses UUIDs for the primary keys of most tables,

Should work. I'm fairly sure I did this with ActiveRecord, too, at one point, 
though i don't remember how.

> and takes
> advantage of PostgreSQL's "array" datatype to let me eliminate five or six
> linking tables,

App Engine also has a list type. Support for it is currently workable but not 
great, but I do have plans to implement associations through arrays of ids at 
some point, for example.

> > Assuming this is a requirement, the most flexible approach seems to be
> > some sort of reverse proxy. Apache can do it, nginx makes it simple and
> > lightweight, fairly trivial to just say "Any URL that starts with this
> > gets forwarded to this port on localhost."
> 
> You'd think so. I need it because I *am* using a reverse proxy. However,
> the redirect _attaches the port number_,

Yeah, it shouldn't do that. Either Rails doesn't, or nginx does strip that 
(unlikely), because I've hosted production Rails apps in exactly this 
environment -- nginx listening on example.com, forwarding to multiple Mongrels 
on various ports, not necessarily on the same machine.

So, probably somewhere in Ramaze.

> I've tried adding URL rewrite rules in apache to fix them, but the
> interaction with the reverse proxy has utterly confounded me.

I don't remember how, but I know that one thing Apache's rewrite rules can do 
is pipe URLs to an external program. It's a trivial protocol (it sends the URL 
on stdin, you give it the new URL on stdout), and that external program is a 
long-running one, so you could even write that in Ruby.

But it seems like it should be much easier to fix this at the source.