Aber bei Ruby geht es doch um eine einfach und lesbare Schreibweise.
Und das Wort join ist ja nicht so sinnvoll.
Daher find ich immer noch das Rails.root + 'config' + 'environments'
die schönste und einfachste Schreibweise ist und
"#{Rails.root}/config/environments/" die schlechteste.
Und da die meisten nicht wissen, dass Rails.root ein Pathname-Objekt
zurück gibt, finde ich dies auch erwähnenswert.
Aber im Endeffekt kann sich ja jeder selber überlegen was er macht.
Am 8. September 2010 11:29 schrieb Thomas R. Koll <[email protected]>:
> Jetzt mach ich bei dem Unsinn mal auch noch mit:
> Das hier geht auch:
>
> Rails.root.join('config', 'environments')
>
>
> Am 08.09.2010 um 11:12 schrieb Marco Scholl:
>
>> Nein. Rails.root liefert ein Pathname object. Da kann man einfach addieren.
>>
>> Am 8. September 2010 10:55 schrieb Michael Schuerig <[email protected]>:
>>> On Wednesday 08 September 2010, Marco Scholl wrote:
>>>> Dann sollte man aber Rails.root auch sauber verwenden:
>>>>
>>>> environments = Dir.entries(Rails.root + 'config' +
>>>> 'environments').map{ |env| env[/(.+)\.rb$/, 1] }.compact
>>>
>>> Dann aber so, oder?
>>>
>>> Dir.entries(File.join(Rails.root, 'config', 'environments')).map{ |env|
>>> env[/(.+)\.rb$/, 1]
>>> }.compact
>>>
>>> Michael
>>>
>>> --
>>> Michael Schuerig
>>> mailto:[email protected]
>>> http://www.schuerig.de/michael/
>>> _______________________________________________
>>> rubyonrails-ug mailing list
>>> [email protected]
>>> http://mailman.headflash.com/listinfo/rubyonrails-ug
>>>
>>
>>
>>
>> --
>> mfg marco
>> _______________________________________________
>> rubyonrails-ug mailing list
>> [email protected]
>> http://mailman.headflash.com/listinfo/rubyonrails-ug
>
> --
> Thomas R. "TomK32" Koll
> just a geek trying to change the world
> http://ananasblau.com || http://photostre.am || http://photolog.at
>
> _______________________________________________
> rubyonrails-ug mailing list
> [email protected]
> http://mailman.headflash.com/listinfo/rubyonrails-ug
>
--
mfg marco
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/listinfo/rubyonrails-ug