The Rails pluralizer is designed to cover 99% of use cases, but not
100%.   It's impossible to reach 100%; they've stopped accepting
patches for the pluralizer.

The usual solution is to do something like:

has_many :my_sub_classes, :class_name => "MySubClass"

What's interesting about your test case is that it appears to being
run through the singularization twice.   my_sub_classes ->
my_sub_class -> my_sub_clas

That might indicate a bug in Hobo somewhere.

Bryan

On Wed, Apr 17, 2013 at 11:57 AM, Paul <[email protected]> wrote:
> Got the following errors while running a Hobo 2.0.0 app on Rails 3.2.12 on
> ruby 1.9.3-p327. The error looks to me like it is a problem with Rails or
> Hobo.
>
> I found a solution to the problem as described below.
>
> Example that caused the problem to surface
> Created two models, MyClass and MySubClass where MyClass has_many
> :my_sub_classes. And, not that I think it matters, these controllers belong
> to the admin subsite.
>
> All working fine until I added an :index page for MySubClass to MyClass.
>
> my_sub_classes_controller.rb
> auto_actions_for : my_classes, [:index]
>
> Error occured when I requested localhost:3000/my_classes/1/my_sub_classes
>
> Couldn't find MyClass without an ID
>
> Request
>
> Parameters:
>
> {"my_clas_id"=>"1"}
>
>
> Using rails console I was able to confirm by executing
> 'my_class'.singularize => 'my_clas'
> At the same time, 'my_classes'.singularize => 'my_class'
>
> My Solution
> I was able to correct the problem by adding the following to
> config/initializers/inflections.rb
>
> ActiveSupport::Inflector.inflections do |inflect|
>   inflect.singular /^([a-z_\-]+ss)$/i, '\1'
> end
>
>
> Looking forward to feedback.
>
> Best,
>  Paul
>
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/hobousers?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to