Every time I run a migration concerning a model with a phony_normalize, the following exception is raised :
No attribute foo found on Model (PhonyRails)
The exception is raised from lib/phony_rails.rb:73.
A warning wouldn't be enough ? I have to comment every phony_normalize in my models before running a migration, then uncommenting them.
The phony_normalize class method checks if the attributes it should normalize exist.
We could move the raise to the set_phony_normalized_numbers method so it is raised when the actual attribute is written.
Feel free to create a pull request :)
Thanks for the great tool!
#phony_normalize with :as throws "not an attribute" exception when I attempt to create database column.
Upon rake db:migrate and rake db:schema:load:
'customer_contact_phone_number_normalized' is not an attribute on PropertyManager. You might want to use 'phony_normalized_method :customer_contact_phone_number' (PhonyRails)
Makes sense, in a way, since the database column's not yet been created.
However, this does mean I can only run those commands by commenting out #phony_normalize.
Am I doing everything correctly?
Quick thought- would it help to manually declare customer_contact_phone_number_normalized as an attr_accessor in the model? Thanks!
...it seems to work, at least.
@JamesCropcho it does indeed. Migrations with conflicting models is an issue that happens more often. We could remove or maybe postpone the check however. Pull request welcome for this :)
@joost I had success with manually declaring as an attr_accessor as described above.
Regarding modification of current behavior- well, I actually like the sanity check you've put in, as is, myself. so I'm loathe to suggest modifying it, now that we have a workaround.
Thanks again for the great tool, sir.