Re: [Rails-core] [feature-bug request] Correct diacritics for Romanian
I don't know if I'm the proper person, because I've never created a gem before. I'm an intermediate Rails programmer (more beginner than intermediate). Also, I don't know much about middleware in Rails. Please advise. Regards, Nicolae vineri, 7 noiembrie 2014, 09:26:26 UTC+2, Prem Sichanugrist a scris: > Can this be done by using a middleware? If so, I'd say you could start a > gem that injects this into middleware stack. > > While I see that this error is legit, I don't think the fix will be in > Rails Core because the core team (that I don't think anybody knows > Romanian) would be suitable to maintain this set of functionality as they'd > never use it. > > Let me know if you need some help to find the place to plug in. > > Thanks, > Prem > > > > On Fri, Nov 7, 2014 at 2:20 PM, Nicolae Popa > wrote: > >> This is a combined feature-bug request, and, ironically, it's due to >> Microsoft's error. >> >> *Problem*: Windows 95, 98, 2000, 2003 server and XP are unable to >> display the correct diacritics for Romanian language. Instead, these >> versions were projected to use some Turkish diacritics. The correct >> diacritis in Romanian are [ș, Ș, ț, Ț]. The incorrect diacritics are: [ş, >> Ş, ţ, Ţ]. In all fonts, correct characters are not defined. Microsoft >> was unable to correct the problem, so there is no patch. >> >> If a user running, for instance, Windows XP, is visiting a website >> containing ș, Ș, ț, Ț, these characters are replaced by small >> rectangles, like the one in file error1.png. Also, when filling in a form, >> the user will type the incorrect characters, because the keyboard layout is >> wrong. >> >> *Possible Solution*: If *config.i18n.default_locale* is *:ro* and the >> browser's operating system is *not Windows NT* or is *Windows NT prior >> to 6.0 (Vista)*, then Rails should: >> 1. replace [ş, Ş, ţ, Ţ] with [ș, Ș, ț, Ț] if the request is POST >> 2. replace [ș, Ș, ț, Ț] with [ş, Ş, ţ, Ţ] if the request is GET >> These 2 replacements should be applied not only to request/response's >> html body, but also to the URL. >> >> The browser's operating system can be checked from HTTP_USER_AGENT. Old >> versions of Windows are not coded 'NT'. The problem applies also for >> versions of Windows coded 'NT' prior to version 6.0 (Windows Vista). >> >> *Sidenote:* Wikipedia is the only website I know to address this >> problem: >> http://ro.wikipedia.org/wiki/Wikipedia:Diacriticele_vechi_%C8%99i_noi >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to rubyonrails-co...@googlegroups.com . >> To post to this group, send email to rubyonra...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/rubyonrails-core. >> For more options, visit https://groups.google.com/d/optout. >> > > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.
Re: [Rails-core] [feature-bug request] Correct diacritics for Romanian
Can this be done by using a middleware? If so, I'd say you could start a gem that injects this into middleware stack. While I see that this error is legit, I don't think the fix will be in Rails Core because the core team (that I don't think anybody knows Romanian) would be suitable to maintain this set of functionality as they'd never use it. Let me know if you need some help to find the place to plug in. Thanks, Prem On Fri, Nov 7, 2014 at 2:20 PM, Nicolae Popa wrote: > This is a combined feature-bug request, and, ironically, it's due to > Microsoft's error. > *Problem*: Windows 95, 98, 2000, 2003 server and XP are unable to display > the correct diacritics for Romanian language. Instead, these versions were > projected to use some Turkish diacritics. The correct diacritis in Romanian > are [ș, Ș, ț, Ț]. The incorrect diacritics are: [ş, Ş, ţ, Ţ]. In all fonts, > correct characters are not defined. Microsoft was unable to correct the > problem, so there is no patch. > If a user running, for instance, Windows XP, is visiting a website > containing ș, Ș, ț, Ț, these characters are replaced by small rectangles, > like the one in file error1.png. Also, when filling in a form, the user > will type the incorrect characters, because the keyboard layout is wrong. > *Possible Solution*: If *config.i18n.default_locale* is *:ro* and the > browser's operating system is *not Windows NT* or is *Windows NT prior to > 6.0 (Vista)*, then Rails should: > 1. replace [ş, Ş, ţ, Ţ] with [ș, Ș, ț, Ț] if the request is POST > 2. replace [ș, Ș, ț, Ț] with [ş, Ş, ţ, Ţ] if the request is GET > These 2 replacements should be applied not only to request/response's html > body, but also to the URL. > The browser's operating system can be checked from HTTP_USER_AGENT. Old > versions of Windows are not coded 'NT'. The problem applies also for > versions of Windows coded 'NT' prior to version 6.0 (Windows Vista). > *Sidenote:* Wikipedia is the only website I know to address this problem: > http://ro.wikipedia.org/wiki/Wikipedia:Diacriticele_vechi_%C8%99i_noi > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-core+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.
[Rails-core] [feature-bug request] Correct diacritics for Romanian
This is a combined feature-bug request, and, ironically, it's due to Microsoft's error. *Problem*: Windows 95, 98, 2000, 2003 server and XP are unable to display the correct diacritics for Romanian language. Instead, these versions were projected to use some Turkish diacritics. The correct diacritis in Romanian are [ș, Ș, ț, Ț]. The incorrect diacritics are: [ş, Ş, ţ, Ţ]. In all fonts, correct characters are not defined. Microsoft was unable to correct the problem, so there is no patch. If a user running, for instance, Windows XP, is visiting a website containing ș, Ș, ț, Ț, these characters are replaced by small rectangles, like the one in file error1.png. Also, when filling in a form, the user will type the incorrect characters, because the keyboard layout is wrong. *Possible Solution*: If *config.i18n.default_locale* is *:ro* and the browser's operating system is *not Windows NT* or is *Windows NT prior to 6.0 (Vista)*, then Rails should: 1. replace [ş, Ş, ţ, Ţ] with [ș, Ș, ț, Ț] if the request is POST 2. replace [ș, Ș, ț, Ț] with [ş, Ş, ţ, Ţ] if the request is GET These 2 replacements should be applied not only to request/response's html body, but also to the URL. The browser's operating system can be checked from HTTP_USER_AGENT. Old versions of Windows are not coded 'NT'. The problem applies also for versions of Windows coded 'NT' prior to version 6.0 (Windows Vista). *Sidenote:* Wikipedia is the only website I know to address this problem: http://ro.wikipedia.org/wiki/Wikipedia:Diacriticele_vechi_%C8%99i_noi -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.
[Rails-core] Adding dirty checking by default to uniqueness validations
I find it a bit odd that validates_uniqueness_of always hits the database even when the attribute we are concerned with has not changed. It's easy enough to add a dirty checking condition to a uniqueness validation, but it seems like this should be the default behavior and always running the validation should require some sort of a flag. Would this change be accepted? Thanks, Ryan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.
Re: [Rails-core] has_association? method on ActiveRecord
On Nov 6, 2014, at 12:33 AM, Danny Sperry wrote: > About a month ago I ran into a case where I needed to know if an AR object's > association exists dynamically. I was building a CMS Engine. > > I thought maybe this was a one off, but last week I found out my co-worker > also had a need for this in the CMS he was building. So I've come to the > community to see if this is something we think should be added into > ActiveRecord. > > I originally solved for this quite naively with the following solution > > def is_association?(attribute) > respond_to?(attribute) && !attribute_names.include?(attribute.to_s) > end > > and after trying to actually solve it in ActiveRecord I discovered > reflections. I think this is easily solved with something like the following > method inside lib/active_record/assocations.rb or > lib/active_record/relation.rb > > def has_association?(name) > reflections.include? name > end > > I'm new to contributing to open source and have been developing with Rails > for about a year so any and all questions, comments, criticism is welcome. > > Thanks! I’m not certain where this would be useful, since every time I’ve needed to check for an association’s existence it was as a warmup to actually doing something with the reflection object. As an example, this code: if has_association?(:foobar) refl = reflect_on_association(:foobar) … could just as well be written: refl = reflect_on_association(:foobar) if refl … Can you discuss why has_association? would be useful in your code? —Matt Jones signature.asc Description: Message signed with OpenPGP using GPGMail
Re: [Rails-core] t(".key") convenience pollutes global i18n namespace
I think it's fine adding a default namespace for such lookups, it should be preferred over the non-namespaced version (eg in docs and everywhere), but I don't think we need to actually break existing functionality. We could just add this and leave the existing one in place as a fallback, or deprecate it. I'm still not sure deprecating is the best solution right now, so I'd like to hear other thoughts about it, but I'm ok on adding the namespace. On Thu, Nov 6, 2014 at 10:33 AM, Joshua Cody wrote: > Nicolas, for a PR, do you feel like we should: > > 1) accept a backwards-incompatible change and begin nesting under “views:” > > 2) create a sort of lookup hierarchy like in ActiveRecord model > translations that first looks in “views:” then the current path > > 3) keep the same default but introduce an ActionView setting for a > namespace that folks can opt in to > > On Tuesday, November 4, 2014 2:06:08 AM UTC-6, Nicolas Cavigneaux wrote: >> >> >> Le 3 nov. 2014 à 15:14, Joshua Cody a écrit : >> >> > Considering the Rails guides give an example structure of nesting view >> translations under "views", it feels like using the period convenience with >> the t() helper should by default look to the "views" i18n namespace, or at >> least provide an ActionView setting for a view namespace. This would bring >> the behavior of views more in line with that of models and keep from >> polluting the global i18n namespace with view-specific translations. >> > >> > Maybe I'm totally off-base—does anyone have opinions on this? >> >> Hi Joshua, I agree with you. I always felt it was some kind of pollution >> too. It would be nice if t() helper used with period was using a namespace. >> >> — >> Nicolas Cavigneaux >> http://www.bounga.org >> http://www.cavigneaux.net >> >> -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-core+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/d/optout. > -- At. Carlos Antonio -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.
Re: [Rails-core] t(".key") convenience pollutes global i18n namespace
Nicolas, for a PR, do you feel like we should: 1) accept a backwards-incompatible change and begin nesting under “views:” 2) create a sort of lookup hierarchy like in ActiveRecord model translations that first looks in “views:” then the current path 3) keep the same default but introduce an ActionView setting for a namespace that folks can opt in to On Tuesday, November 4, 2014 2:06:08 AM UTC-6, Nicolas Cavigneaux wrote: > > > Le 3 nov. 2014 à 15:14, Joshua Cody > a > écrit : > > > Considering the Rails guides give an example structure of nesting view > translations under "views", it feels like using the period convenience with > the t() helper should by default look to the "views" i18n namespace, or at > least provide an ActionView setting for a view namespace. This would bring > the behavior of views more in line with that of models and keep from > polluting the global i18n namespace with view-specific translations. > > > > Maybe I'm totally off-base—does anyone have opinions on this? > > Hi Joshua, I agree with you. I always felt it was some kind of pollution > too. It would be nice if t() helper used with period was using a namespace. > > — > Nicolas Cavigneaux > http://www.bounga.org > http://www.cavigneaux.net > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.
[Rails-core] has_association? method on ActiveRecord
About a month ago I ran into a case where I needed to know if an AR object's association exists dynamically. I was building a CMS Engine. I thought maybe this was a one off, but last week I found out my co-worker also had a need for this in the CMS he was building. So I've come to the community to see if this is something we think should be added into ActiveRecord. I originally solved for this quite naively with the following solution def is_association?(attribute) respond_to?(attribute) && !attribute_names.include?(attribute.to_s) end and after trying to actually solve it in ActiveRecord I discovered reflections. I think this is easily solved with something like the following method inside lib/active_record/assocations.rb or lib/active_record/relation.rb def has_association?(name) reflections.include? name end I'm new to contributing to open source and have been developing with Rails for about a year so any and all questions, comments, criticism is welcome. Thanks! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.