Cant View ddp data for edit


#1

I have a simple app that will not allow me to see data ddp data when editing. I am able to add without n issue. Here a simple snippet.

 /client/config/router/

Router.route('/editLoyaltyCampaign/:_id', {
name: 'editLoyaltyCampaign',
data: function(){ 
 console.log(LoyaltyInstantReward.findOne({_id: this.params._id})); //returns undefined.
 return LoyaltyInstantReward.findOne({_id: this.params._id});
},

onBeforeAction: function(){
var currentUser = Meteor.userId();
if(currentUser){
    this.next();
} else {
    this.render("loginTwo");
}
},
  subscriptions: function(){
   return Meteor.subscribe('LoyaltyInstantReward');
  }
});

//both/collection/
LoyaltyInstantReward = new Mongo.Collection('loyaltyinstantreward');

if (Meteor.isServer) {
     Meteor.publish(LoyaltyInstantReward, function () {
     var v = LoyaltyInstantReward.find();
     return v;
  });
}

var LoyaltyInstantRewardSchema = new SimpleSchema({
   //fields here
});

LoyaltyInstantReward.attachSchema( LoyaltyInstantRewardSchema );

Any one can tell what I am doing wrong. I am really a newbie to meteor.


#2

You are asking questions without pasting formatted code.


#3

My Bad. I have corrected unformatted code.


#4

Any help. I cant see what I am doing wrong. I have spent a week so far. reading tutorials and code but cannot see what i am doing wrong to be not able to see ddp data, even though I am seeing a list using aldeed tabular. when i click on one of the items to view details it does not show.


#5

I found the answer here: http://stackoverflow.com/questions/32895318/meteor-flow-router-issue-with-update