[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Large, existing database for RoR

johntwinn

3/15/2006 10:55:00 PM

Hi,
My organisation has a relatively large legacy database that has a java
application (using hibernate) to perform analytics on the data.

We need to develop a CRUD application for it and I have been looking at
Ruby on Rails and scffolding to do it. It does not need to be fancy
interface at all, just have an ability for CRUD.

What I am concerning about is the Id field in RoR and having it change
the datamodel. As other application are using it, is it possible to
have RoR integrate directly with an exisitng data schema without
changing it ? All the tutorials sort of do DB development when writing
the web application.

Thanks in advance, it means a lot of time would be saved!

4 Answers

Julian Leviston

3/15/2006 11:14:00 PM

0

Yes, you can specify what the id is.

I suggest taking a look at http://api.rubyon...

Find on ActiveRecord::Base then within that, search for set_primary_key.

Basically this is what you want to set the primary key to invId for
rails' purposes:

class Invoice < ActiveRecord::Base
set_primary_key 'invId'
end

On 16/03/2006, at 9:58 AM, johntwinn@gmail.com wrote:

> Hi,
> My organisation has a relatively large legacy database that has a java
> application (using hibernate) to perform analytics on the data.
>
> We need to develop a CRUD application for it and I have been
> looking at
> Ruby on Rails and scffolding to do it. It does not need to be fancy
> interface at all, just have an ability for CRUD.
>
> What I am concerning about is the Id field in RoR and having it change
> the datamodel. As other application are using it, is it possible to
> have RoR integrate directly with an exisitng data schema without
> changing it ? All the tutorials sort of do DB development when writing
> the web application.
>
> Thanks in advance, it means a lot of time would be saved!
>
>



Jacob Fugal

3/15/2006 11:16:00 PM

0

On 3/15/06, johntwinn@gmail.com <johntwinn@gmail.com> wrote:
> What I am concerning about is the Id field in RoR and having it change
> the datamodel. As other application are using it, is it possible to
> have RoR integrate directly with an exisitng data schema without
> changing it ? All the tutorials sort of do DB development when writing
> the web application.

Yes, this is definitely possible. Check out the API docs on
ActiveRecord[1], specifically the set_primary_key[2] class method.
Example:

class Project < ActiveRecord::Base
set_primary_key "legacy_id"
end

Jacob Fugal

(PS. For future reference, these questions are much better directed at
the Rails specific mailing list[3])

[1] http://api.rubyonrails.org/classes/ActiveRecord...
[2] http://api.rubyonrails.org/classes/ActiveRecord...#M000741
[3] http://lists.rubyonrails.org/mailman/list...


johntwinn

3/15/2006 11:22:00 PM

0

that is great Julain and Jacob!! I will have a go and get back if i
have further questions!

Cheers

William Clark

12/17/2010 10:34:00 PM

0

In article <3c0ng6524qm7ea6qhk03rdpefaqcbmitv6@4ax.com>,
Fred J. McCall <fjmccall@gmail.com> wrote:

> William Clark <wclark2@colnospamumbus.rr.com> wrote:
>
> >In article <rlmlg6h8l12lcqkif53de4cnecd2gkdolc@4ax.com>,
> > Fred J. McCall <fjmccall@gmail.com> wrote:
> >
> >> William Clark <wclark2@colnospamumbus.rr.com> wrote:
> >>
> >> >In article <6kckg6lvvkb44504u5o5564l5u0ti8h9m0@4ax.com>,
> >> > Fred J. McCall <fjmccall@gmail.com> wrote:
> >> >
> >> >> William Clark <wclark2@colnospamumbus.rr.com> wrote:
> >> >>
> >> >> >In article <s37kg6lkbldbau9na57951s4q2c4chrp7o@4ax.com>,
> >> >> > Fred J. McCall <fjmccall@gmail.com> wrote:
> >> >> >
> >> >> >> William Clark <wclark2@colnospamumbus.rr.com> wrote:
> >> >> >>
> >> >> >> >In article <0u0jg653lgjf9k9grkc9ookaodvj2me338@4ax.com>,
> >> >> >> > Fred J. McCall <fjmccall@gmail.com> wrote:
> >> >> >> >
> >> >> >> >> "conwaycaine" <conwaycaine@bellsouth.net> wrote:
> >> >> >> >>
> >> >> >> >> >
> >> >> >> >> >"William Clark" <wclark2@colnospamumbus.rr.com> wrote in message
> >> >> >> >> >news:wclark2-BD9055.20151513122010@charm.magnus.acs.ohio-state.ed
> >> >> >> >> >u..
> >> >> >> >> >.
> >> >> >> >> >
> >> >> >> >> >> I like to have a pretty calm and quiet atmosphere in the car
> >> >> >> >> >> while I
> >> >> >> >> >> drive, and I tend not to make too much small talk. I also like
> >> >> >> >> >> my
> >> >> >> >> >> other
> >> >> >> >> >> passengers to be aware of the driving environment, so they
> >> >> >> >> >> know
> >> >> >> >> >> when
> >> >> >> >> >> to
> >> >> >> >> >> keep conversation to a minimum while we are in potentially
> >> >> >> >> >> dangerous
> >> >> >> >> >> situations. That is something the cell phone caller talking to
> >> >> >> >> >> the
> >> >> >> >> >> car's
> >> >> >> >> >> driver cannot be sensitive to.
> >> >> >> >> >
> >> >> >> >> >A flaming Car Nanny!!!
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> Worse than that. He assumes we all share his limitations when it
> >> >> >> >> comes to driving a car.
> >> >> >> >>
> >> >> >> >> We don't....
> >> >> >> >>
> >> >> >> >
> >> >> >> >Oh, just what I like to come across on the road. The idiot who
> >> >> >> >thinks
> >> >> >> >he
> >> >> >> >is a better driver than anyone else.
> >> >> >> >
> >> >> >>
> >> >> >> Oh, it's not that I'm a better driver than everyone else. It's that
> >> >> >> everyone else (including me) is apparently a better driver than YOU.
> >> >> >
> >> >> >Evidence?
> >> >> >
> >> >>
> >> >> Simple. You're afraid and I'm not.
> >> >
> >> >"Afraid"? No, I am not afraid, I'm just all too aware of the terrible
> >> >driving habits I see on the roads here every day.
> >> >
> >>
> >> You sure SOUND afraid. "Please, government, PROTECT ME!"
> >
> >You seem to have trouble differentiating between fear and concern. The
> >only thing I would like the government to do is devise a much stiffer
> >driving test before they let these clowns out on the roads.
> >
>
> Poor boy. His asshole must itch. It's the only reason I can think of
> for wanting to keep swallowing the hook deeper.

Indeed, "swallowing the hook deeper" is Freddie-speech for, "I can't
find a response, so I'll try to childish insults again, and hope the
nasty man goes away".
>
>> >> >> >
> >> >> >> >PS: FYI - I used to drive cars fast for money, ...
> >> >> >> >
> >> >> >>
> >> >> >> Of course you did. Yeah, we all believe everything you say. We
> >> >> >> even
> >> >> >> believe it makes a difference that you were a chauffeur or a cab
> >> >> >> driver in some former life.
> >> >> >
> >> >> >Prove it. Or else withdraw. I know you can't stand others who actually
> >> >> >do anything other than sneer at others on the usenet, but get used to
> >> >> >it.
> >> >> >
> >> >>
> >> >> Prove WHAT, you silly little twat? You're the one making all the
> >> >> stupid and unsupported claims and assertions.
> >> >>
> >> >> Withdrawal is something your Da should have practiced nine months
> >> >> prior to your birth.
> >> >>
> >> >
> >> >Oh, you really are a disgusting piece of trash, aren't you? Can't cut it
> >> >it intellectually, so foul-mouthed ad hominems are all that are left to
> >> >you.
> >>
> >> What was 'foul-mouthed' in the preceding?
> >>
> >> Gee, I'm sorry if I hit a nerve and upset you. You were an
> >> 'accident', then? Strained through a condom, no doubt...
> >
> >See elsewhere. Sorry you have no short term memory. Or any wit, either.
> >
>
> In other words, you're obsessing over the 'bad' words. Poor infant.

No, just pitying your inability to defend your position without
resorting to the gutter.
>
> >
> >Sucks to be you.
> >
>
> Actually, no. Not so much.

Really, it does.
>

> >> >> >> >... and I still don't think I
> >> >> >> >can take driving on the freeway for granted.
> >> >> >> >
> >> >> >>
> >> >> >> Oh, I agree. YOU probably can't.
> >> >> >>
> >> >> >
> >> >> >Not when there are morons like you around, I can't.
> >> >> >
> >> >>
> >> >> So keep it parked if you can't manage the traffic, boyo...
> >> >
> >> >
> >> >Oh, I can manage the traffic a whole lot better than you. One of the
> >> >ways I do so is by being very aware of those with a sub-normal driving
> >> >IQ - like yourself.
> >> >
> >>
> >> Sure, Mr "I used to drive fast". Whatever you say. Yet I can manage
> >> to drive everywhere I've ever been, while you cower in fear of some
> >> folks from a state that's mostly vowels.
> >>
> >> Yeah, we believe you...
> >>
> >
> >So all you can do when the facts don't suit your prejudice is try to
> >pretend they aren't true? How very grown up of you.
> >
>
> What 'facts' would those be? Your unsupported bleating? Hardly
> 'facts'.

The "facts" that I have experience of three driving tests, in the two
countries in question, and you don;t. So when I say that US tests are a
joke, all you can do is bleat pitifully, because someone has the
temerity to think that some things in the US are not done as well as
elsewhere.

Well, tough. Suck it up like an adult.
>
> >
> >You do remember the
> >old Escort RS 2000, I take it? Good - so do I. Very well, as a matter of
> >fact.
> >
>
> How nice for you. I'm pleased that you're all excited about some
> dinky POS Ford...

As I thought - you haven't a clue what I am talking about. Position
normal.
>
> Sorry, but I'm more likely to remember 2-seaters - and I don't mean
> the kind you get by ripping out the back seat.

Indeed, the E-type was nice, but the RS2000 kicked its ass on the road.