sxross / MotionModel

Simple Model and Validation Mixins for RubyMotion
MIT License
192 stars 67 forks source link

Method missing Exception in motion model for 'create_at=' and 'updated_at=' #82

Open midhunkrishna opened 11 years ago

midhunkrishna commented 11 years ago

While looping through server response and populating the model, at times motion model raises either of the following exception

model.rb:802:in `method_missing:': undefined method `created_at='

or

 model.rb:802:in `method_missing:': undefined method `updated_at='

This is not happening consistently but when it happens we have no clue why it is happening.

tacticiankerala commented 11 years ago

Sorry, forgot to mention one thing, We don't have 'created_at' and 'updated_at' fields in our model. Could that be the reason? But it works 8/10 tries!

sxross commented 11 years ago

Not at my computer but can you make sure you're pointing to master on github and not using the gem?

Sent from my iPhone

On Sep 3, 2013, at 11:30 PM, Sreenath Nannat notifications@github.com wrote:

Sorry, forgot to mention one thing, We don't have 'created_at' and 'updated_at' fields in our model. Could that be the reason? But it works 8/10 tries!

— Reply to this email directly or view it on GitHub.

techogate commented 10 years ago

I encountered this issue recently [motion_model (0.5.3)], in the same inconsistent manner and for the same use case. Adding explicit :created_at and :updated_at columns to the Model classes eliminated the problem.

sxross commented 10 years ago

Is there any way to create a reproducible spec for this? I need some code that fails sometimes. Also, for the model that's failing, are you using default values for any of the columns, and what is the position of the columns in the declaration relative to the auto-timestamp columns.