Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Associations defined after structure block not taken into account #14

Closed
KieranP opened this Issue Nov 24, 2011 · 4 comments

Comments

Projects
None yet
2 participants

KieranP commented Nov 24, 2011

> Region: 'country_id' is no longer in use. [(D)estroy / (I)gnore]: I
> Section: 'video_id' is no longer in use. [(D)estroy / (I)gnore]: I
> Talent: 'human_id' is no longer in use. [(D)estroy / (I)gnore]: I

All those association id fields are for simple belongs_to declarations, but migrant wants to get rid of them.

Looking at the README, is it because I define my belongs_to after my structure block?

Owner

pascalh1011 commented Nov 24, 2011

Yeah, the structure class method reflects on associations wherever it's called, so if you put your relationships after the structure block, Rails doesn't report them to Migrant.

KieranP commented Nov 24, 2011

Can you do what Hobo Fields does, and override belongs_to?

e.g. pseudo code

def self.belongs_to(*args)
  super
  @schema.parse_associations
end
Owner

pascalh1011 commented Nov 25, 2011

@KieranP Would you be able to check out from master and let me know if everything works for you now?

Thanks!

Owner

pascalh1011 commented Nov 29, 2011

Haven't heard anything so closing for now. Fixed in 1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment