In Rolling with Ruby on Rails tutorial - http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html - I saw that to introduce a new element to my domain, I needed to define it in a table, generate a model element with a similar name and the class would autoamtically take the attributes from the table definition. Is it possible to do this in the other direction... i.e to take the class diagram and automatically generate the table definition. Would this be something build into Rails, or require a 3rd party tool? My intention is to use RSA to define my domain model, export the classes to Ruby and use this to drive the scaffolding set up in Rails. If you have any direct experince with this or can point me to other tutorials, it would be much appreciated! ---------> Jamie -- Posted via http://www.ruby-forum.com/.
Rails, specifically ActiveRecord [the ''Model'' in MVC], serves the very specific role of object-relational mapping and as a result the entire framework [currently] is very database centric [as intended by its author].. I came from an RSA [of course it was called rose back then] world and a similar experience that it seems youre having when being introduced to rails. What you need to look into is ''Migrations'': http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations This essentially allows you to describe your database tables/handle the management and migration of them in pure ruby [as opposed to SQL] - you still have to describe their relationships in the Model classes that you generate as a result of the table generation. Unfortunatly RSA [and arguably UML] won''t do you much good other than perhaps a UML-esque diagram of your model [which could be invaluable if things get complex] - the most popular UML concepts exist in database design as well, c.f. aggregation and has_many, etc. As you''ll find modeling data is fundamentally similar regardless of what abstract lingo you choose to author it in.. Theres also a difference of culture at play [I''m assuming] RSA, and all the tools in the Rational Unified Process are very concerned with process, documentation, etc. Rails is a framework geared toward Agile development, which is generally not concerned with formal processes, nor detailed documentation like a sequence diagram, et al. i.e. youre mixing apples and oranges.. Jamie wrote:> In Rolling with Ruby on Rails tutorial - > http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html - I saw that to > introduce a new element to my domain, I needed to define it in a table, > generate a model element with a similar name and the class would > autoamtically take the attributes from the table definition. Is it > possible to do this in the other direction... i.e to take the class > diagram and automatically generate the table definition. Would this be > something build into Rails, or require a 3rd party tool? > > My intention is to use RSA to define my domain model, export the classes > to Ruby and use this to drive the scaffolding set up in Rails. > > If you have any direct experince with this or can point me to other > tutorials, it would be much appreciated! > > ---------> Jamie-- Posted via http://www.ruby-forum.com/.
I have heard that Nitro/OG is setup in this fashion. Haven''t tried it first hand though, so not sure how valuable it may be. -NSHB On 8/14/06, Brez! !! <jbresnik@gmail.com> wrote:> > Rails, specifically ActiveRecord [the ''Model'' in MVC], serves the very > specific role of object-relational mapping and as a result the entire > framework [currently] is very database centric [as intended by its > author].. I came from an RSA [of course it was called rose back then] > world and a similar experience that it seems youre having when being > introduced to rails. What you need to look into is ''Migrations'': > > http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations > > This essentially allows you to describe your database tables/handle the > management and migration of them in pure ruby [as opposed to SQL] - you > still have to describe their relationships in the Model classes that you > generate as a result of the table generation. > > Unfortunatly RSA [and arguably UML] won''t do you much good other than > perhaps a UML-esque diagram of your model [which could be invaluable if > things get complex] - the most popular UML concepts exist in database > design as well, c.f. aggregation and has_many, etc. As you''ll find > modeling data is fundamentally similar regardless of what abstract lingo > you choose to author it in.. > > Theres also a difference of culture at play [I''m assuming] RSA, and all > the tools in the Rational Unified Process are very concerned with > process, documentation, etc. Rails is a framework geared toward Agile > development, which is generally not concerned with formal processes, nor > detailed documentation like a sequence diagram, et al. i.e. youre > mixing apples and oranges.. > > > > Jamie wrote: > > In Rolling with Ruby on Rails tutorial - > > http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html - I saw that to > > introduce a new element to my domain, I needed to define it in a table, > > generate a model element with a similar name and the class would > > autoamtically take the attributes from the table definition. Is it > > possible to do this in the other direction... i.e to take the class > > diagram and automatically generate the table definition. Would this be > > something build into Rails, or require a 3rd party tool? > > > > My intention is to use RSA to define my domain model, export the classes > > to Ruby and use this to drive the scaffolding set up in Rails. > > > > If you have any direct experince with this or can point me to other > > tutorials, it would be much appreciated! > > > > ---------> Jamie > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Kind regards, Nathaniel Brown Inimit Innovations Inc. http://inimit.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060814/97fd97aa/attachment.html
My recollection of the entirety of the Rose/RSA toolset is fuzzy, but I do remember it being tricky to model dynamic stuff. Migrations in Rails are inherently dynamic, you build in extra migrations to expand your DB schema as your entities/models grow and evolve. I dont know if RSA models this very well.
Hey Brez, Thank you very much for your response. I do plan on using the Agile methodology, rather than RUP, but am using UML as a notation at my disposal to define the domain model. Irrespective of methodology this is an essential artifact and I believe describing the domain model is easier using a class diagram than an ERD. Though both will work. Perhaps I should look towards object-relational mapping tools, so that I can convert from XMI to SQL and then bring it into Ruby through the database route? -- Posted via http://www.ruby-forum.com/.
On Aug 14, 2006, at 1:50 AM, Nathaniel Brown wrote:> I have heard that Nitro/OG is setup in this fashion. Haven''t tried > it first hand though, so not sure how valuable it may be. > > -NSHBNitro/Og is setup this way. With Og as the ORM you just define normal ruby classes. Then you use attr_accessor and friends which Og overides to add persistence to the db transparently. Its really quite slick. I would encourage anyone using rails to also check out Nitro. Its a bit different but its very nice in its own way. -Ezra