Reputation: 457
I'm getting this error in my heroku logs:
Here's the create method in my pins_controller
def create
code = params[:pin][:code]
@classroom = Classroom.where('code LIKE ?', code).first
unless @classroom
flash[:error] = "Classroom code incorrect"
render :new
else
params[:pin][:classroom_id] = @classroom.id
end
@pin = Pin.new(pin_params)
@pin.save
params[:pin][:emotion_ids].each do |emotion_id|
@emotion = Emotion.find(emotion_id)
@pin.emotions << @emotion
end
respond_with(@pin)
authorize @pin
end
I recently created a new instance of my app on a staging url and a product url (pointing to my domain) I ran rake db:migrate so that should be working and most of the other features on the site are fine.
Why would this work locally but not in heroku?
Thanks for your help.
Upvotes: 0
Views: 82
Reputation: 3335
It could be you haven't seeded your database yet since you only ran a migration. If there were emotion objects in your database in your development environment they won't be in your heroku production environment. Maybe create a seed file, add some emotions to it, and see if the error still exists. It doesn't seem like a problem on heroku just seems like a lack of an object existing when you call each on it.
Upvotes: 1