Re: [Rails] Re: Generate model from database

2011-10-20 Thread Noel
On Thu, Oct 20, 2011 at 8:20 AM, genterminl wrote: > Tim, > > Thanks.  That looks like exactly what I need to get started.  I'm simply not > familiar enough yet with ruby or rails to have come up with that from > scratch myself, but I can certainly use it and modify it to handle the > naming conve

[Rails] Re: Generate model from database

2011-10-20 Thread genterminl
Tim, Thanks. That looks like exactly what I need to get started. I'm simply not familiar enough yet with ruby or rails to have come up with that from scratch myself, but I can certainly use it and modify it to handle the naming conventions in my existing schema. Now I have to go back to wo

[Rails] Re: Generate model from database

2011-10-20 Thread Tim Shaffer
Well you don't exactly have to do it by *hand*. It's pretty easy to write a script to generate the command for you. Just change table_name to whatever your model is... table_name = "Post" output = [ "rails g scaffold #{table_name} --skip-migration" ] ignore_columns = [ 'id', 'created_at', 'updat

[Rails] Re: Generate model from database

2011-10-20 Thread Doug
On Oct 19, 4:16 pm, genterminl wrote: > The whole point is I have lots of tables with lots of columns, and I don't > want to have to do all that typing.  The magic_model_generator creates all > the model files, and it can obviously see all the columns in the database, > I'm just surprised that n

Re: [Rails] Re: Generate model from database

2011-10-19 Thread genterminl
The whole point is I have lots of tables with lots of columns, and I don't want to have to do all that typing. The magic_model_generator creates all the model files, and it can obviously see all the columns in the database, I'm just surprised that nobody has extended it or created something els

Re: [Rails] Re: Generate model from database

2011-10-19 Thread Tim Shaffer
I believe you can also pass a "--skip-migration" option to scaffold so it won't generate the migration. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails

Re: [Rails] Re: Generate model from database

2011-10-19 Thread Paul
On Tue, Oct 18, 2011 at 5:05 PM, genterminl wrote: > This is a problem I am also facing - trying to set up a rails app with > a legacy database.  The minimal model file Colin suggests works fine > for access to the database, but I would love it if the scaffold (view, > controller, ...) files could

[Rails] Re: Generate model from database

2011-10-18 Thread genterminl
Oct 18, 11:40 am, Colin Law wrote: > On 18 October 2011 16:25, prasetya utama wrote: > > > yes i want to generate model, but the table has been created in > > databases. And i want generate that table :) > > You say that you want to generate just the model, so you do not want > to generate the fu

[Rails] Re: Generate model from database

2011-10-18 Thread prasetya utama
Thanks colin, for your advice :) and your coment -- 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@googlegroups.com. To unsubscribe from this

Re: [Rails] Re: Generate model from database

2011-10-18 Thread Colin Law
On 18 October 2011 16:25, prasetya utama wrote: > yes i want to generate model, but the table has been created in > databases. And i want generate that table :) I asked last time that you don't top post, it makes it difficult to follow the thread, insert your reply at appropriate points in previo

[Rails] Re: Generate model from database

2011-10-18 Thread prasetya utama
yes i want to generate model, but the table has been created in databases. And i want generate that table :) -- 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

Re: [Rails] Re: Generate model from database

2011-10-18 Thread Colin Law
On 18 October 2011 15:59, prasetya utama wrote: Please don't top post, it makes it difficult to follow the thread, insert your reply at appropriate points in previous message. Thanks. > @colin : i haven't understand, can you explain how to make it. may be > script for generate it like if i want

[Rails] Re: Generate model from database

2011-10-18 Thread prasetya utama
@colin : i haven't understand, can you explain how to make it. may be script for generate it like if i want generate controller (ruby script/generate ...) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Ta