this regcounselor_controller
def new
@regcounselor = Regcounselor.new
end
def create
@regcounselor = Regcounselor.new(params[:regcounselor])
if @regcounselor.save
flash[:notice] = ‘Regcounselor was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end
def pictureimg=(picture_field)
return if picture_field.blank?
self.content_type = picture_field.content_type.chomp
self.picture = picture_field.read
end
def image
@regcounselor = Regcounselor.find(params[:id])
send_data @regcounselor.picture, :filename => “photo.jpg”,?
:type => @regcounselor.content_type, :disposition => “inline”
end
when i submit the file new.rhtml this error come out…
undefined method `pictureimg=’ for #Regcounselor:0x474e9ac
i think this error happen because this code
def create
@regcounselor = Regcounselor.new(params[:regcounselor])
if @regcounselor.save
flash[:notice] = ‘Regcounselor was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end
but i don’t know how to fix this problem.
please help me…