Hi all;

I wonder if anyone could suggest a work-around to this little inconvenience 
with the Hobo Migration Generator:

In my Instrument model, I have a self-referencing verification as follows:

class Instrument < ActiveRecord::Base

  fields do
    instrument_no :decimal, :default => 0, :precision => 12, :scale => 3, 
:default => 0, :index => true
  end

  belongs_to  :original_lease, 
      :class_name => "Instrument", 
      :foreign_key => :original_lease_instrument, 
      :primary_key => :instrument_no, 
      :conditions => "nature = 'LEASE'"

end

So this means when an Instrument record specifies a value for 
*original_lease_instrument,* the original lease instrument pointed to must 
have a nature of 'LEASE'.

However, in my application, the instrument_no field is *decimal*. 

The Hobo Migration Generator keeps thinking (or assuming) that the 
original_lease_instrument field is an *integer*. How do I override this? 

I had to create a custom migration to reset it to decimal, but everytime I 
generate a subsequent migration for anything else, Hobo wants to set it 
back to an integer field:

class AddFrenchOwnershipTextToTitle < ActiveRecord::Migration
  def self.up
    change_column :instruments, :original_lease_instrument, :integer, 
:limit => nil, :default => nil


It means I now have to edit every migration to remove that directive.

Any ideas? Where does it get this assumption from? 

Tim

-- 
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/d/optout.

Reply via email to