PalaniKannan K
2010-Sep-03 10:16 UTC
RoR with Existing tables in database using Postgresql
Hi, I am new bee to Rais. I need to create a Rails application with existing database with several number of tables. When i came across web, I didn''t find any fruitful ideas for developing application using existing tables. Everything i found was to create new database with Create, Edit, Insert feature. I need to create a application using existing postgresql database stuffed with tables where i have to provide view only permission to the user. Kinldy help me in this regard. I have 15 tables in my database which developed in postgresql. Advance thanx to my friends of RoR-Talk. -- With Regards, Palani Kannan. K -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, I am new bee to Rais. I need to create a Rails application with existing database with several number of tables. When i came across web, I didn''t find any fruitful ideas for developing application using existing tables. Everything i found was to create new database with Create, Edit, Insert feature. I need to create a application using existing postgresql database stuffed with tables where i have to provide view only permission to the user. Kinldy help me in this regard. I have 15 tables in my database which developed in postgresql. Advance thanx to my friends of RoR-Talk. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Start with googling ''rails legacy database'' for ideas. Providing only ''read access'' simply means your rails application should not accept any new/create/update requests, and there are numerous ways to defend against this. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Richard Henwood
2010-Sep-03 14:21 UTC
Re: RoR with Existing tables in database using Postgresql
On Fri, 03 Sep 2010 12:16:26 +0200, PalaniKannan K wrote:> Hi, > > I am new bee to Rais. I need to create a Rails application with existing > database with several number of tables. When i came across web, I didn''t > find any fruitful ideas for developing application using existing > tables. Everything i found was to create new database with Create, Edit, > Insert feature. I need to create a application using existing postgresql > database stuffed with tables where i have to provide view only > permission to the user. Kinldy help me in this regard. I have 15 tables > in my database which developed in postgresql. Advance thanx to my > friends of RoR-Talk. --Hi Palani, you might find this helpful: http://www.theirishpenguin.com/2009/11/26/generate-rails-migrations-from- your-postgresql-or-mysql-database/ richard, -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
PalaniKannan K
2010-Sep-03 15:58 UTC
Re: Re: RoR with Existing tables in database using Postgresql
On 3 September 2010 16:08, Ar Chron <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Start with googling ''rails legacy database'' for ideas. >Yaa... I will use this hint. Thank You.> > Providing only ''read access'' simply means your rails application should > not accept any new/create/update requests, and there are numerous ways > to defend against this. >Can you please tell me the ways... It will be useful to me. Tanx advance.> -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- With Regards Palani Kannan. K Office: +49-531-2616-226 Mobile: +4917647098166 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
PalaniKannan K
2010-Sep-03 15:59 UTC
Re: Re: RoR with Existing tables in database using Postgresql
On 3 September 2010 16:21, Richard Henwood <rjhenwood-/E1597aS9LT10XsdtD+oqA@public.gmane.org> wrote:> On Fri, 03 Sep 2010 12:16:26 +0200, PalaniKannan K wrote: > > > Hi, > > > > I am new bee to Rais. I need to create a Rails application with existing > > database with several number of tables. When i came across web, I didn''t > > find any fruitful ideas for developing application using existing > > tables. Everything i found was to create new database with Create, Edit, > > Insert feature. I need to create a application using existing postgresql > > database stuffed with tables where i have to provide view only > > permission to the user. Kinldy help me in this regard. I have 15 tables > > in my database which developed in postgresql. Advance thanx to my > > friends of RoR-Talk. -- > > Hi Palani, > > you might find this helpful: >I feel that, this is same kind of results I got in google search... Creating model using dumped schemas of existing table. but, its not working.> > http://www.theirishpenguin.com/2009/11/26/generate-rails-migrations-from- > your-postgresql-or-mysql-database/<http://www.theirishpenguin.com/2009/11/26/generate-rails-migrations-from-%0Ayour-postgresql-or-mysql-database/> > > richard, > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- With Regards Palani Kannan. K Office: +49-531-2616-226 Mobile: +4917647098166 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2010-Sep-03 16:23 UTC
Re: Re: RoR with Existing tables in database using Postgresql
On Fri, Sep 3, 2010 at 8:59 AM, PalaniKannan K <kpalanikannan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I feel that, this is same kind of results I got in google search... Creating > model using dumped schemas of existing table. but, its not working."its not working" isn''t particularly useful information. So you have an existing table, say "things". You create a model for it, e.g. class Thing < ActiveRecord::Base end Done. Maybe you have to tell it there''s a non-Rails-standard index field, etc., but basically that''s it. There''s no reason to be fooling with migrations if you have an existing table, unless you can and want to do transformations on them to make them more Rails-like. So what have you tried, and what''s the actual problem? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
PalaniKannan K
2010-Sep-03 18:18 UTC
Re: Re: RoR with Existing tables in database using Postgresql
On 3 September 2010 18:23, Hassan Schroeder <hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> On Fri, Sep 3, 2010 at 8:59 AM, PalaniKannan K <kpalanikannan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > I feel that, this is same kind of results I got in google search... > Creating > > model using dumped schemas of existing table. but, its not working. > > "its not working" isn''t particularly useful information. > > So you have an existing table, say "things". You create a model for > it, e.g. > > class Thing < ActiveRecord::Base > end > > Done. Maybe you have to tell it there''s a non-Rails-standard index > field, etc., but basically that''s it. There''s no reason to be fooling with > migrations if you have an existing table, unless you can and want to > do transformations on them to make them more Rails-like. >Realy Sorry... If my problem was not understandable. I am a new bee... there is no perfect tutorials available for already existing tables to develop web interface. In before cases I used cgi and perl. Now I started ruby and RoR. I feel its totally different from cgi. If you know any turorials with examples, kindly tell me. In previously mentioned link, I am unable to understand.> > So what have you tried, and what''s the actual problem? > > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- With Regards Palani Kannan. K Office: +49-531-2616-226 Mobile: +4917647098166 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2010-Sep-03 19:14 UTC
Re: Re: RoR with Existing tables in database using Postgresql
On Fri, Sep 3, 2010 at 11:18 AM, PalaniKannan K <kpalanikannan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote> Realy Sorry... If my problem was not understandable. I am a new bee... there > is no perfect tutorials available for already existing tables to develop web > interface. In before cases I used cgi and perl. Now I started ruby and RoR. > I feel its totally different from cgi. If you know any turorials with > examples, kindly tell me. In previously mentioned link, I am unable to > understand.The earlier link was irrelevant, ignore it. The advice to google "rails legacy database" from Ar Chron should help, though. In any case, make a copy of your existing DB and point your Rails app at it. Create a model based on an existing table e.g. "things", as in class Thing < ActiveRecord::Base end Then start a console and type thing = Thing.first Look at the result. That should get you started :-) And no, sorry, I don''t know of any specific tutorials on doing this. It would probably be easier if you''d already developed at least a trivial green-field Rails app (gone through the basic tutorials, guides, etc.) FWIW, and good luck, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sep 3, 12:14 pm, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Create a model based on an existing table e.g. "things", as in > > class Thing < ActiveRecord::Base > end >Odds are, you will need to tell Rails what the primary key of your legacy table is, unless it happens to be "id" class Thing < ActiveRecord::Base set_primary_key "[PKFieldName]" end -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2010-Sep-03 22:10 UTC
Re: Re: RoR with Existing tables in database using Postgresql
On Fri, Sep 3, 2010 at 2:47 PM, E. Litwin <elitwin-ur4TIblo6goN+BqQ9rBEUg@public.gmane.org> wrote:> Odds are, you will need to tell Rails what the primary key of your > legacy table is, unless it happens to be "id"Absolutely, and odds are the OP will encounter other grief in the form of naming conventions/pluralization yadda yadda. :-) But creating a model and seeing what happens and where it breaks[*] is the best way to start, IMO. And as a matter of fact I''m currently up to my armpits in a similar project, though I do have the leeway to do a few Railsizations to the db schema, thankfully. [*] by writing tests, hopefully! FWIW, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Haven''t used them but I would check them out.. http://magicmodels.rubyforge.org/magic_model_generator/ http://github.com/ahe/reverse_scaffold Also, read this forum to consider some potential messy things. http://www.ruby-forum.com/topic/149050 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
PalaniKannan K
2010-Sep-06 12:51 UTC
Re: Re: RoR with Existing tables in database using Postgresql
Hi, The Problem got solved... Thank you for valuable comments from each one in this thread. On 4 September 2010 00:52, Cuz Ican <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Haven''t used them but I would check them out.. > http://magicmodels.rubyforge.org/magic_model_generator/ > http://github.com/ahe/reverse_scaffold > > Also, read this forum to consider some potential messy things. > http://www.ruby-forum.com/topic/149050 > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- With Regards Palani Kannan. K Office: +49-531-2616-226 Mobile: +4917647098166 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.