resolve/refinerycms — Issue #1370: Error with the table name in generated engines
Author: eltercero
Created: 2012-02-29 08:51:14+00:00
State: open

After generating an engine like this:

rails generate refinery:engine job_offer title:string description:text --i18n title description

I have an error while doing the migration. This is the error:

```
$ rake db:migrate
== CreateJobOffersJobOffers: migrating =======================================
-- create_table(:refinery_job_offers)
-> 0.0019s
rake aborted!
An error has occurred, this and all later migrations canceled:

undefined method `singularize' for :refinery_job_offers:Symbol
```

If i write `Refinery::JobOffers::JobOffer` in the rails console, I get the same error output.

I fixed it myself adding a `.to_s` to the table name in the model. Like this:

```ruby
self.table_name = :refinery_job_offers.to_s
```

After that, I could do the migrations without a flaw and everything seems to work fine :)