Wednesday 15 May 2013

indexing - Initiating DELETE request batman.js and rails 3 from index view -


I am creating a Rail 3 app using batman.js for front end. When I am in the show.html view of a personal record, I am able to submit a successful delete request but when I am in the index.html view, the same Method of deletion of method is not being triggered. I'm guessing that when a Batman.js triggers a delete request that I do not understand then there is a little magic. There is probably something done with the scope of the index.html view in the place . I show my code for the controller and two thoughts in the question. If you need anything else, please ask.

/app/assets/javascripts/controllers/venues_controller.js.coffee

  Square plans and images expand VenuesController Batman. Controller routing that: 'Location' Index: (Parameters) - & gt; @set 'newVenue', new plans and pictures. Venue Plans & Pictures Ven.load (mistake, location) = & gt; @set 'venues', plans and pictures. Venue. ('Loaded') Show: (Parameters) - & gt; Plans & Pictures VenueFund Parseint (Params.ID, 10), (mistake, result) => If you forget, then forget to throw 'place', result @ render source: create 'venue / display': (params) - & gt; @ NewVenue.save (err, place) = & gt; if! In the event of a mistake, 'new' new, new plans and pictures Venue Plans & Pictures Venue. ('Load'). Add (Places) Update: (Parameters) - & gt; Delete: (Params) - & gt; @gate ('venue'). Destruction (mistake) = & gt; Do not make a mistake unless you make a mistake, unless there is no error for Batman. Errsset Plan and Pictures. FleshShoot "was successfully removed!" @redirect '/ venues'   

/app/assets/javascripts/views/venues/show.html

    

/app/assets/javascripts/views/venues/index.html

  & lt; H2 & gt; Places & lt; / H2 & gt; & Lt; Table & gt; & Lt; Thead & gt; & Lt; Th & gt; Name & lt; / Th & gt; & Lt; Th & gt; Details & lt; / Th & gt; & Lt; Th & gt; Address & lt; / Th & gt; & Lt; Th & gt; City & lt; / Th & gt; & Lt; Th & gt; State & lt; / Th & gt; & Lt; / Thead & gt; & Lt; Tbody & gt; & Lt; Tr data-foreach-venue = "venues" & gt; & Lt; Td data-bind = "venue.name" & gt; & Lt; / Td> & Lt; Td data-bind = "sitedata" & gt; & Lt; / Td> & Lt; Td data-bind = "venue.address" & gt; & Lt; / Td> & Lt; Td data-bind = "venue.city" & gt; & Lt; / Td> & Lt; Td data-bind = "venue.state" & gt; & Lt; / Td> & Lt; Td> & Lt; A data route = "routes. Place [venue]" & gt; Show & lt; / A & gt; & Lt; / Td> & Lt; Td> & Lt; A data-event-click = "controller.WenJustrooy | with aggregates site" & gt; Remove & lt; / A & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; H3 & gt; Add a location & lt; / H3 & gt; & Lt; Form Data-Form-Formamine = "Controller.ne.ew.NewNew" Data-Event-Submit = "Controllers.wean.Sent" & gt; & Lt; Input class = "new item" placeholder = "name" data-bind = "site name" /> & Lt; Input class = "new item" placeholder = "description" data-bound = "sitedata" /> & Lt; Input class = "new item" placeholder = "address" data-bind = "venue.address" /> & Lt; Input class = "new item" placeholder = "city" data-bind = "venue.city" /> & Lt; Input class = "new item" placeholder = "state" data-bind = "venue.state" /> & Lt; Input class = "new item" type = "number" placeholder = "1" data-bind = "venue.user_id" /> & Lt; Input type = "submit" value = "add place" / & gt; & Lt; / Form & gt;    

Your administrator assumes that this site is set to @get ('place' ), , but it is not necessary that the index is not set on the view if the change is made: Destroyed (Parameters) - & gt; @gate ('venue'). Destruction (mistake) = & gt;

to:

  deleted: (venue) - & gt; Place.destroy (err) = & gt;   

And both of these references should work.

No comments:

Post a Comment