Skip to main content
0 online

Ruby on Rails and web-app integration

deanh77 by deanh77Founder · Oct 27, 2005 · 109 views

Well the powers that be here at work have me looking into Ruby On Rails... It seems pretty cool, although first impression is that all the slick stuff they show you (automatic model class defined via database table structure, relationships, etc.) could also be done in Java with the right frameworks used. But it is really quick to get up and running. I'm just curious about things like transactions etc.

Anyway, they want me to create a simple web app in Ruby and then integrate it with our existing web app. This seems impossible. just adding a link to our current app to this other one won't work for reasons like how do we handle user authentication? how do we skin this app when we are using Spring themes for the original app? our current navigation is dynamic, showing/unshowing tabs based on various factors, role permissions, theme variables, account status. So how do I show that navigation on the new web-app?

Simple answer would be to somehow *include* this new app inside the original app, so that navigation would still be handled by the original app. But how to do this is still up in the air.

To contribute to the discussion, please log in.

18 Comments

juicymango #4 juicymangoOG 2003

ruby ruby ruby ruby soho

yay #4.1 yayOG 2004

the fact that you even made it here is hilarious

iwz #4.1.1 iwz

destination: juicymango

yay #3 yayOG 2004

Is this a linux type open source thing?

deanh77 #3.1 deanh77Founder

it is open source and runs on linux (and windows, and mac, probably others).

rails is an open-source web framework written in Ruby. And ruby is an open-source language (written in C)

yay #3.1.1 yayOG 2004

bah yeah ill pass. this web dev stuff is starting to bore me

iwz #3.1.1.1 iwz

dude, you have to check this out. watch the 15 minute video on www.rubyonrails.com

yay yayOG 2004

Ok I checked it out.
Ok this is my obviously premature biased opinion. VS.NET blows this away.

iwz iwz

VisualStudio.NET? yeah?

yay yayOG 2004

Yeah. C# + .NET + ASP
I don't know tough to say, I work with VS fair amount. Maybe VS.NET doesn't neccesarily have the ORM strength yet (soon to come if not already in ObjectSpaces which is gorgeous), but I use DTM for this and it works incredibly well.

A .NET app in development feels more like a standard application, and has this same focus on removing page states and automatically binding databases as it looks for Ruby on Rails in the demo. I guess the fully integrated IDE is what takes the cake for me, I get tired of figuring out what scripts do what, especially when I don't work on the same technologies or projects for more than a month at a time.

Plus a library like .NET is full, extensive, simplistic. MS moves it forward, sometimes standards move backwards

iwz #2 iwz

So, wow, rails is really cool. Ruby itself seems pretty cool too.

So, since you were into trying out an ezabel rails incarnation, I thought I'd give it a try myself.

First question:

Should there be a separate controller for each model?

I have a User model and a News model right now. I made a controller called "EZabelController" for User and scaffold setup index, list, show, new, create, edit, update, and destroy, but it's all User specific. Should I really have a UserController, and a NewsController?

iwz #2.1 iwz

and, sheesh, the eZabel schema needs a lot of cleaning up to work well with rails. but in a good way

deanh77 #2.1.1 deanh77Founder

yeah? don't forget about single table inheritance!

iwz #2.1.1.1 iwz

not familiar with this, yet. does this have something to do with that reserved word "type" for database columns? i got some error about that because i had a CATEGORY.TYPE column. had to rename it.

deanh77 deanh77Founder

yes. I remember you have like a generic table that contains data for either an Article, an Journal, a Thread.

if those are subclasses of a generic "Content" class, then the name of the table would be "contents" and an article would have "Article" in the 'type' column (rails places this value when you create and save a "Article" object)

this is single-table-inheritance.

if you get more interested in this, you should check out the book: "Agile Web Development with Rails"

deanh77 #2.2 deanh77Founder

cool. I never got around to making an ezabel rails app. too busy.

If you want to use scaffold to create your controllers then yes, you would create multiple controllers, one for each model.

but you *could* put all the functionality into one controller (manually) if you wanted to. you'd just have actions like "create_user", "create_news". just keep in mind the naming conventions though, because then you'd need .rhtml files that correspond to the action names.

its really up to you, off hand, I think you'd want to have seperate controllers, just to keep functionality seperate.

iwz #1 iwz

I've heard good things about Ruby on Rails. But, I'm curious as to the motivation of their switch?

Yeah, moving a user over to another server would require a new session and authentication, etc...

We're currently in the process of integrating a reporting application into our existing webapp.

The reporting stuff runs on its own server, so we just set it up in a frame, and pass the username and password on the url. The authentication is then processed on the reporting server and a session is established. It seems to be the only solution, unless we were to actually merge our two applications into a single server (which is possible but requires a lot more in licensing fees). We have our app's navigation in a frame on the top, and the reporting app in a frame on the bottom. Works reasonably well.

Our next task is getting the style/gui consistent across the two apps. This is a work in progress.

And when it comes to permissions/privileges, the report server has its own security model that we've hooked up to our database. It handles all of its own stuff in its own way, we just hook it up to our data and config.

deanh77 #1.1 deanh77Founder

I like your idea of the frame. I'm gonna give it a shot.

Welcome Back to eZabel

It's been a while. Here's what's new.

eZabel Lore

A complete history of our community — stats, Hall of Fame, legendary threads, and more.

View the Lore →

Curator Commentary

Look for the blue speech bubbles on threads, profiles, and news — notes and context from iwz.

Everything Preserved

All 225,969 pieces of content from 2000–2014 are here — forums, messages, journals, photos, polls, and events.