Re: Re: Rails'' inflections are messy

Paul
Sat, 28 Jul 2012 14:21:23 -0000

I just ran into this again. I attempted to call a model "Media", and
the scaffold decided that I meant "Medium", which is NOT a newspaper;
it''s someone who has a seance. As I often do in that situation, I
deleted those files and changed the name to "MediaOutlet" so it would
act predictably.

Here''s what would be nice to happen:

model: Media
controller: media_controller
route: /media, media_path, media_new_path, etc...
params: params[''media''][''etc'']

That beats having to call pluralize and singularize all the time and
try to keep it straight.

This is especially important for constructing stuff in javascript
because the easiest thing is to just assume it is normal and add an
''s''.

On Sat, Jul 28, 2012 at 3:01 AM, davidcelis
<david-8+ab0rdVlAuDvotElmWtJA@public.gmane.org>
wrote:
> Rails itself depends on pluralization for the reasons I stated in my last
> message.
>
>
> On Friday, July 27, 2012 10:03:54 PM UTC-7, Rafael C. de Almeida wrote:
>>
>> Maybe I''m missing something, but couldn''t the default
inflection just
>> don''t do anything? That is, the plural of any word is the word
itself. From
>> the user point of view, it would be like there is no pluralization at
all.
>>
>> Cheers
>>
>> On Friday, July 27, 2012 12:00:59 PM UTC-3, davidcelis wrote:
>>>
>>> I don''t think that''s really a good option. Some
Rails internals already
>>> rely heavily upon the inflections; there have to be some
pluralizations
>>> loaded by default (whether from within the framework, or an
inflections
>>> gem). If they WERE to be extracted into a gem (which is what I
did), it
>>> would still need to be bundled by default. Inflections are used in
routing,
>>> mapping between models and controllers, and a lot of other places
within
>>> Rails. They need to be there.
>>>
>>> On Thursday, July 26, 2012 6:21:26 PM UTC-7, Rafael C. de Almeida
wrote:
>>>>
>>>> One thing that have always bothered me about the inflector and
this
>>>> pluralize business is that it only work in English. That make
rails newbies
>>>> from non-english speaking countries have a harder time learning
the
>>>> technology than they should. I know ruby''s keywords
are already in English,
>>>> and so are method names and so on. But reading a foreing
language is easier;
>>>> and so is using already defined names. However, a person who
doesn''t know
>>>> English very well will not do a good job in naming his own
variables and
>>>> models in English. A famous quote from computer science field
goes: "There
>>>> are only two hard things in Computer Science: cache
invalidation and
>>>> naming things". Imagine naming it in a language you
aren''t proficient.
>>>>
>>>> Perhaps inflection should not be the default. Maybe it should
be
>>>> optional. If you want it, then you can load your
language''s inflection gem,
>>>> if it''s available.
>
> --
> 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
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/WTQyy8fiZHkJ.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
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.