I am still confused by rails 3 new rules, and knowing so little about it,I want some help on a particular problem: inflection when creating models: what can I do in order to get rails generate model using words ending in ''a'', so that the plural generated add an ''s'' If I edit config/initializers/inflections.rb and add the appropiate rule inflect.plural /(.*)a$/, ''\1as'' I solve the problem. What collateral effects is to expect ? GP -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Aug 6, 12:16 pm, gatopardo <gato.pa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am still confused by rails 3 new rules, and knowing so little about > it,I want some help on a particular problem: inflection when creating > models: > what can I do in order to get rails generate model using words ending > in ''a'', so that the plural generated add an ''s'' > > If I edit config/initializers/inflections.rb and add the > appropiate rule > inflect.plural /(.*)a$/, ''\1as'' > I solve the problem. > > What collateral effects is to expect ? >As far as I know, all this does is change inflections. This can have consequences if it ends up changing the pluralization of existing, models, resources etc. that were in your app. For example rails knows that has_many :items means that the associated model is Item. if you changed the pluralization rules such that when rails singularized items it got something other than item then rails would guess the wrong class name That said, for me pluralizing words ending in ''a'' does seem to just add a s. Fred Fred> GP-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 6 August 2011 13:48, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Aug 6, 12:16 pm, gatopardo <gato.pa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> I am still confused by rails 3 new rules, and knowing so little about >> it,I want some help on a particular problem: inflection when creating >> models: >> what can I do in order to get rails generate model using words ending >> in ''a'', so that the plural generated add an ''s'' >> >> If I edit config/initializers/inflections.rb and add the >> appropiate rule >> inflect.plural /(.*)a$/, ''\1as'' >> I solve the problem. >> >> What collateral effects is to expect ? >> > > As far as I know, all this does is change inflections. This can have > consequences if it ends up changing the pluralization of existing, > models, resources etc. that were in your app. For example rails knows > that has_many :items means that the associated model is Item. if you > changed the pluralization rules such that when rails singularized > items it got something other than item then rails would guess the > wrong class name > That said, for me pluralizing words ending in ''a'' does seem to just > add a s.Many words ending in "a" are already plural. For example the plural of datum is data. @OP: out of interest what words are you pluralising? Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.