ruby on rails - ActionController::MethodNotAllowed -
i have rails model called 'audioclip'. orginally created scaffold 'new' action, replaced 'new_record' , 'new_upload', becasue there 2 ways attach audio model.
going /audioclips/new_record doesn't work because takes 'new_record' if id. instead of changing this, trying create '/record_clip' , '/upload_clip' paths.
so in routes.db have:
map.record_clip '/record_clip', :controller => 'audioclips', :action => 'new_record' map.upload_clip '/upload_clip', :controller => 'audioclips', :action => 'new_upload'
when navigate /record_clip, get
actioncontroller::methodnotallowed get, head, post, put, , delete requests allowed.
i'm not extremely familiar inner-workings of routing yet. problem here? (if helps, have these 2 statements above map.resources => :audioclips
yes, 2 routes conflicting mapped resource (the map.resources => :audioclips
bit).
if want continue using resources, suggest change line to:
map.resources => :audioclips, :new => { :new_record_clip => :post, :new_upload_clip => :post }
if want more information, rails guide incredibly helpful on topic:
http://guides.rubyonrails.org/routing.html#adding-more-restful-actions
Comments
Post a Comment