hzamani/active_record-acts_as — pull request #1 by robjacoby (2014-07-31 06:16:04+00:00)
Title: Namespaced models cause exceptions setting `acting_as_model`

Due to calling `name.to_s.camelize.constantize` if the acts_as relation name doesn't exactly match a Class, it throws a `NameError`, which is the case for namespaced models.

For example, take the following models

```ruby
module Inventory
class ProductFeature < ActiveRecord::Base
self.table_name = 'inventory_product_features'
actable
validates_presence_of :name, :price

def present
"#{name} - $#{price}"
end
end

class PenLid < ActiveRecord::Base
self.table_name = 'inventory_pen_lids'
acts_as :product_feature

validates_presence_of :color
end
end
```
Because the `ProductFeature` class does not exist without the namespace, it throws an exception.

This pull request modifies the setter of `acts_as_model` to use the `class_name` option if it exists, or falls back to using the name before constantizing. This also allows for naming the relationship something different to the class used (current practice in ActiveRecord)