Hey folks, Not sure about you, but when setting up a rails project, I get tired of specifying username, login, etc 3 times, when it should only be done once, in the config/database.yml file. To me, it makes more sense to use yaml and do the following: login: &login adapter: mysql encoding: utf8 username: robert password: super_secret development: database: cool_app_development <<: *login test: database: cool_app_test <<: *login production: database: cool_app_production <<: *login So, I''ve written a patch for mysql and postgres generators to follow the above, instead of what we are used to. Links below, looking for some +1''s :) link: http://dev.rubyonrails.org/ticket/10069 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 4, 2007 8:32 PM, Robert Evans <ruby-forum-incoming@andreas-s.net> wrote:> > So, I''ve written a patch for mysql and postgres generators to follow the > above, instead of what we are used to. Links below, looking for some > +1''s :)I use it, but have noticed that a significant number of coders don''t like this YAML feature. Please, express your opinions here. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 4, 9:40 pm, "Mislav Marohnić" <mislav.maroh...@gmail.com> wrote:> On Nov 4, 2007 8:32 PM, Robert Evans <ruby-forum-incom...@andreas-s.net> > wrote: > > > > > So, I''ve written a patch for mysql and postgres generators to follow the > > above, instead of what we are used to. Links below, looking for some > > +1''s :) > > I use it, but have noticed that a significant number of coders don''t like > this YAML feature. > > Please, express your opinions here.The syntax is too obscure and not many people know it. It could confuse people who use Rails for the first time, or people who are not intimately familiar with YAML. I think it''s more important that the config file is easy to read, than saving 20 seconds at the beginning of a project. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On 11/5/07, Hongli Lai <honglilai@gmail.com> wrote:> The syntax is too obscure and not many people know it. It could > confuse people who use Rails for the first time, or people who are not > intimately familiar with YAML. I think it''s more important that the > config file is easy to read, than saving 20 seconds at the beginning > of a project.I agree. Perhaps it could just be a link in the comments of database.yml which points to more info on the rails rdoc/trac? -- Chad --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 5, 2:35 pm, "Chad Woolley" <thewoolley...@gmail.com> wrote:> On 11/5/07, Hongli Lai <hongli...@gmail.com> wrote: > I agree. Perhaps it could just be a link in the comments of > database.yml which points to more info on the rails rdoc/trac?Yes, that''s a good compromise. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
How about keeping the structure I suggested, but adding comments explaining the structure for clarification? To me it makes sense because it DRY''s up your code, something Rails advocates, but doesn''t follow in this area. On Nov 6, 5:08 am, Hongli Lai <hongli...@gmail.com> wrote:> On Nov 5, 2:35 pm, "Chad Woolley" <thewoolley...@gmail.com> wrote: > > > On 11/5/07, Hongli Lai <hongli...@gmail.com> wrote: > > I agree. Perhaps it could just be a link in the comments of > > database.yml which points to more info on the rails rdoc/trac? > > Yes, that''s a good compromise.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 6, 3:52 pm, revans <RobertREv...@gmail.com> wrote:> How about keeping the structure I suggested, but adding comments > explaining the structure for clarification? To me it makes sense > because it DRY''s up your code, something Rails advocates, but doesn''t > follow in this area.Yes but Rails also advocates readability, and unfortunately this YAML syntax doesn''t. I think readability is more important. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Agree. Too much DRY leads to perlism sometimes, this is quite close to that. And not much to gain from it either. On 11/7/07, Hongli Lai <honglilai@gmail.com> wrote:> > On Nov 6, 3:52 pm, revans <RobertREv...@gmail.com> wrote: > > How about keeping the structure I suggested, but adding comments > > explaining the structure for clarification? To me it makes sense > > because it DRY''s up your code, something Rails advocates, but doesn''t > > follow in this area. > > Yes but Rails also advocates readability, and unfortunately this YAML > syntax doesn''t. I think readability is more important. > > > > >-- Cheers! - Pratik http://m.onkey.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
I rarely use the same username and password for my production and development databases, so not only does this obfuscate the file a little bit it also makes me have to do more work when I get ready to do production testing and deployment. --Jeremy On Nov 4, 2007 2:32 PM, Robert Evans <ruby-forum-incoming@andreas-s.net> wrote:> > Hey folks, > > Not sure about you, but when setting up a rails project, I get tired of > specifying username, login, etc 3 times, when it should only be done > once, in the config/database.yml file. > > > To me, it makes more sense to use yaml and do the following: > > login: &login > adapter: mysql > encoding: utf8 > username: robert > password: super_secret > > development: > database: cool_app_development > <<: *login > > test: > database: cool_app_test > <<: *login > > production: > database: cool_app_production > <<: *login > > So, I''ve written a patch for mysql and postgres generators to follow the > above, instead of what we are used to. Links below, looking for some > +1''s :) > > link: http://dev.rubyonrails.org/ticket/10069 > -- > Posted via http://www.ruby-forum.com/. > > > >-- http://www.jeremymcanally.com/ My books: Ruby in Practice http://www.manning.com/mcanally/ My free Ruby e-book http://www.humblelittlerubybook.com/ My blogs: http://www.mrneighborly.com/ http://www.rubyinpractice.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
I totally disagree with the "perlism" comparison here. If it is a taste thing, that''s understandable, but saying the above code snippet is too hard to read or akin to perlism, I don''t agree. But whatever the consensus is, is cool with me. On Nov 7, 6:15 am, Hongli Lai <hongli...@gmail.com> wrote:> On Nov 6, 3:52 pm, revans <RobertREv...@gmail.com> wrote: > > > How about keeping the structure I suggested, but adding comments > > explaining the structure for clarification? To me it makes sense > > because it DRY''s up your code, something Rails advocates, but doesn''t > > follow in this area. > > Yes but Rails also advocates readability, and unfortunately this YAML > syntax doesn''t. I think readability is more important.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Mon, 5 Nov 2007 06:35:42 -0700, Chad Woolley wrote:> On 11/5/07, Hongli Lai <honglilai@gmail.com> wrote: >> The syntax is too obscure and not many people know it. It could >> confuse people who use Rails for the first time, or people who are not >> intimately familiar with YAML. I think it''s more important that the >> config file is easy to read, than saving 20 seconds at the beginning >> of a project. > > I agree. Perhaps it could just be a link in the comments of > database.yml which points to more info on the rails rdoc/trac?Second. I actually use Robert''s syntax myself, as I''m sure many developers do, but it would be too daunting for a first-time configuration. Now, if there were a way to specify "default:" at the top, and have the *code* that reads database.yml merge in the default hash keys, that would be more worthwhile. But -1 for the pure-YAML version. -- Jay Levitt | Boston, MA | My character doesn''t like it when they Faster: jay at jay dot fm | cry or shout or hit. http://www.jay.fm | - Kristoffer --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---