I have a nested form problem. I implemented the nested forms solution form the railscasts 196 & 197. It works if I have no validation errors.
So, form renders pe
at this moment, the only way i find to fix that it was only overwriting the create method.
def new
@property = Property.new
@property.images.build
end
def create
@property = Property.new(params[:property])
if @property.save
flash[:success] = t('Your_property') + ' ' + t('is_successfully_created')
redirect_to myimmonatie_url
else
@property.images.build if @property.images.blank? ##because i'm shure you have something similar to : accepts_nested_attributes_for :images, :reject_if => lambda { |fields| fields[:image].blank? }
render :action => 'new'
end
end
hope it helps!