I was following a tutorial where i found that we can create an instance without passing the address of the contract to create the instance. Like this:
Voting.deployed().then(function(contractInstance) {
contractInstance.voteForCandidate(candidateName, {gas: 140000, from: web3.eth.accounts[0]}).then(function() {
let div_id = candidates[candidateName];
return contractInstance.totalVotesFor.call(candidateName).then(function(v) {
$("#" + div_id).html(v.toString());
$("#msg").html("");
});
I checked the web3.js documentation but couldn't find anything. Is this function deprecated? Is there any other way of creating an instance of a contract without passing the address -I am using truffle and testrpc.