Rails 3.1.3 ruby 1.9 I have a model called, "Give". I understand that it may not be a good choice for a model, but couldn''t be helped. Rails seems to have recognized its singular form to be "gife" rather than "give", which I hoped to be. So, I put in routes.rb resources :gives, :singular => :give But the routes still show new_gife GET /gives/new(.:format) {:action=>"new", :controller=>"gives"} edit_gife GET /gives/:id/edit(.:format) {:action=>"edit", :controller=>"gives"} gife GET /gives/:id(.:format) {:action=>"show", :controller=>"gives"} Do I need to do something else to let it change the singular form of "Gives" to be "give"? Thanks. soichi -- Posted via http://www.ruby-forum.com/. -- 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 https://groups.google.com/groups/opt_out.
On Sep 7, 2012, at 2:07 AM, Soichi Ishida wrote:> Rails 3.1.3 > ruby 1.9 > > I have a model called, "Give". I understand that it may not be a good > choice for a model, but couldn''t be helped. > > Rails seems to have recognized its singular form to be "gife" rather > than "give", which I hoped to be. > So, I put in routes.rb > > resources :gives, :singular => :give > > But the routes still show > > new_gife GET /gives/new(.:format) > {:action=>"new", :controller=>"gives"} > edit_gife GET /gives/:id/edit(.:format) > {:action=>"edit", :controller=>"gives"} > gife GET /gives/:id(.:format) > {:action=>"show", :controller=>"gives"} > > Do I need to do something else to let it change the singular form of > "Gives" to be "give"?Wow, that is really odd. Gife isn''t even a word, as far as I can tell. You can change this in the inflections.rb file in your config/initializers folder. It''s pretty well commented and should work for this case. Walter> > Thanks. > > soichi > > -- > Posted via http://www.ruby-forum.com/. > > -- > 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 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Soichi Ishida wrote in post #1075000:> I have a model called, "Give". I understand that it may not be a good > choice for a model, but couldn''t be helped.You are right that "Give" is a really bad choice for a model name. Models should be nouns not verbs (i.e. One gives a gift). The model would be thing given not the act of giving. That is a really odd inflection bug though. It must be triggering the wrong inflection rule somehow. -- Posted via http://www.ruby-forum.com/. -- 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 https://groups.google.com/groups/opt_out.
On Fri, Sep 7, 2012 at 1:52 PM, Robert Walker <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> That is a really odd inflection bug though. It must be triggering the > wrong inflection rule somehow.It''s probably got a rule to deal with plurals like knives, lives, wives, etc. Seeing a table end in "ives" (and not triggering any higher-priority rule) then makes sense. Now to go munch on sour cream and chife potato chips, and listen to some Burl Ife music.... ;-) -Dave -- Dave Aronson, Available Secret-Cleared Ruby/Rails Freelancer (VA/DC/Remote); see www.DaveAronson.com, www.Codosaur.us, and www.Dare2XL.com for more info. -- 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 https://groups.google.com/groups/opt_out.
Thanks everyone. have added ActiveSupport::Inflector.inflections do |inflect| inflect.irregular ''give'', ''gives'' end in the inflection.rb , then now gives GET /gives(.:format) {:action=>"index", :controller=>"gives"} POST /gives(.:format) {:action=>"create", :controller=>"gives"} new_give GET /gives/new(.:format) {:action=>"new", :controller=>"gives"} edit_give GET /gives/:id/edit(.:format) {:action=>"edit", :controller=>"gives"} give GET /gives/:id(.:format) {:action=>"show", :controller=>"gives"} looking good! Thanks again. soichi -- Posted via http://www.ruby-forum.com/. -- 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 https://groups.google.com/groups/opt_out.