I am trying to create a action that creates a copy of the checked object.
My action so far:
def create_multiple
@webhost = Webhost.find(params[:webhost_ids])
@webhost.each do |webhost|
Webhost.new(:webhost)
end
respond_to do |format|
format.html { redirect_to(:admin_webhosts, :notice => 'Konkurrancerne er nu slettet') }
format.xml { head :ok }
end
end
The action renders but no new webhost copy is created.
Try if that works (notice the
createinstead ofnew, sincenewby itself won’t save it):