Rails 3.2 I am getting the an error on the first line at ":photos", it says undefined method 'model_name' of Symbol:Class. Im lost on this one.
= simple_form_for [@tower, :photos], remote: true, html: {class: 'form-horizontal'} do |f|
= f.error_notification
.modal-body
.modal-body-content
.form-inputs
- @photos.each_with_index do |photo, index|
= simple_fields_for photo do |p|
= render 'form_inputs', f: p, count: index
.modal-footer
= f.submit 'Save', class: 'btn btn-primary'
button.btn type="button" data-dismiss="modal" Cancel
_
# GET /towers/1/photos/new
def new
@tower = Tower.find(params[:tower_id])
@photos = Array.new(3){ @tower.photos.build }
respond_to do |format|
format.html # new.html.slim
format.json { render json: @photos }
end
end
Also in tower.rb "accepts_nested_attributes :photos"