I have this method which after a rake task should save my data to the model, I am trying to update 2 columns at a time, which shouldnt be a problem
def update_fixtures #rake task method
Fixture.destroy_all
get_home_fixtures.each {|home| Fixture.create!(home_team: home )}
get_away_fixtures.each {|away| Fixture.create!(away_team: away )}
end
In this instance only the away team will save, however if i do this
def update_fixtures #rake task method
Fixture.destroy_all
get_away_fixtures.each {|away| Fixture.create!(away_team: away )}
get_home_fixtures.each {|home| Fixture.create!(home_team: home )}
end
Then only the home team will save.
I have tried @model.errors.full_messages but get undefined method for nil class, so there are none?
I am trying to debug this issue but unsure on what i can use to find the problem
Has anyone experienced this before? Driving me insane
EDIT
I can update the field manually from the console, so when I do
Fixture.create(:away_team => "String")
it updates fine
Thanks