Ruby on Rails
ComponentsDontFindTheirModels (Version #8)

One of the clues of associating Controllers and Models in Components correctly seems to be “follow the pluralization rules”(see WhatGetsPluralized). So your model should be named in singular, your DB table should be named in plural as well as your controller. All class definitions should be prefixed with the Component name as in


class SomeComponent::SomeEntity < ActiveRecord::Base
end

# or

class SomeComponent::SomeEntityController < ActionController::Base
end

category: OpenQuestion


I could only get my Controller to find my model by adding


require 'somecomponent/someentity'
</pre>

to the beginning of my somecomponent/someentity_controller.rb file

Christopher Maujean

I noticed that sometimes CamelCase classes end up in files like camel_case.rb

One of the clues of associating Controllers and Models in Components correctly seems to be “follow the pluralization rules”(see WhatGetsPluralized). So your model should be named in singular, your DB table should be named in plural as well as your controller. All class definitions should be prefixed with the Component name as in


class SomeComponent::SomeEntity < ActiveRecord::Base
end

# or

class SomeComponent::SomeEntityController < ActionController::Base
end

category: OpenQuestion


I could only get my Controller to find my model by adding


require 'somecomponent/someentity'
</pre>

to the beginning of my somecomponent/someentity_controller.rb file

Christopher Maujean

I noticed that sometimes CamelCase classes end up in files like camel_case.rb