Good trick Stefan, I have been there and I ended up modifying the
migrations manually after generating them. Thanks!


El 03/12/13 11:20, Stefan Haslinger escribió:
> I had the following issue:
> 
> A hobo model like this: 
> 
>     class Category < ActiveRecord::Base
>       hobo_model
>       fields do
>         ...some fields, nothing special ...
>       end
> 
> 
> And another model
> 
>     class Legacy::Category < ActiveRecord::Base
>       establish_connection "import_development"
>       self.table_name = 'categories'
>     end
> 
> which I use for importing data from a legacy database.
> 
> This confuses the heck out of the migration generator and it wants to
> recreate the table categories in the next migration again.
> I tried to use Generators::Hobo::Migration::Migrator.ignore_models =
> ["Legacy:Category"], but that won't help, the migration gerenator seems
> not to take namespaces into account,
> Generators::Hobo::Migration::Migrator.ignore_models = ["Category"] would
> actually silence it, but also disables migrations for future changes of
> the Category model all together.
> 
> But if I make that legacy model a hobo model (without using any of the
> Hobo features) like this
> 
>     class Legacy::Category < ActiveRecord::Base
>       establish_connection "import_development"
>       self.table_name = 'categories'
>       # The following two lines fix the migration issues
>       hobo_model
>       fields 
>     end
> 
> 
> not only the migration generator is "silenced" for the legacy model, it
> also still works for the original Category model.
> This may be just a coincidence, but who cares? It works! :-)
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
Ignacio Huerta Arteche
http://www.ihuerta.net
Teléfono: 0034 645 70 77 35
Email realizado con software libre

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to