ruby on rails - ActionView::MissingTemplate Error when trying to create new object -



ruby on rails - ActionView::MissingTemplate Error when trying to create new object -

i hitting error "actionview::missingtemplate (missing template home/suites, application/suites {:locale=>[:en], :formats=>[:json], :handlers=>[:erb, :builder, :coffee, :haml, :rabl]}." when tried post (create new) suites (/suites.json). snippets of codes below.

can advise me on how can resolve this? thanks!

suitescontroller.rb

def create @suite = suite.new @suite.text = params[:suite][:text] @suite.description = params[:suite][:description] @suite.remote_image_url = params[:suite][:image_url] if @suite.save render json: suite.standard_to_json(@suite) else render json: @suite.errors, status: :unprocessable_entity end end

suites.rb

class suite include mongoid::document include mongoid::timestamps field :text, type: string field :description, type: string field :image_url, type: string mount_uploader :image, imageuploader validates_presence_of :text validates_presence_of :image def self.standard_to_json(suites) suites.to_json end end

suites.js.coffee

class entities.suite extends backbone.model urlroot: "/suites" class entities.suitescollection extends backbone.collection model: entities.suite url: "/suites" api = getsuites: (cb) -> suites = new entities.suitescollection suites.fetch success: -> cb suites error: -> cb suites newsuite: (suite, cb) -> $.post "/suites.json", suite: suite .success (suite) -> cb (suite) app.reqres.sethandler "suites:get", (cb) -> api.getsuites(cb) app.reqres.sethandler "suite:add", (suite , cb) -> api.newsuite(suite, cb)

at conclusion of create method, need have redirect_to sends user different page (e.g., edit.html.erb). if don't this, controller post data, , seek render create.html.erb page, can't find.

ruby-on-rails json templates coffeescript actionview

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -