Board Thread:Questions and Answers/@comment-25523075-20161028053530/@comment-28905095-20161029000411

Why do you want to put a door on the rails?

If it is to prevent mobs entering somewhere, a better alternative would be to place a fence in the block over the rails. It would seem like it would hinder your use of the rails, but minecarts pass straight through the fence (even when you're riding it).