0

I would like to combine two methods so I can call both methods and use only one button in my view (instead of using two buttons). I am getting "ActionController::UnknownFormat in MusicController#create" when I attempt to call the "reload" method from within "create".

Thanks,

 def create
   notes = params['notes']
   @notes = MusicHelper::Makesong.new(notes).play
 end

 def reload
  respond_to do |format|
    format.js  
    x = (Dir.glob("**/audios/*.wav").min_by {|f| File.mtime(f)})    
    y = (Dir.glob("**/audios/*.wav").count {|f| File.mtime(f)}) 
    if y > 8
      File.delete x
    end
  end
 end

This is what I am trying.

 def create
   notes = params['notes']
   @notes = MusicHelper::Makesong.new(notes).play
   reload
 end

0 Answers0