Ruby Sparks

A novelist struggling with writer’s block finds romance in a most unusual way: by creating a female character he thinks will love him, then willing her into existence.
Director: Jonathan Dayton & Valerie Faris
Writer:  Zoe Kazan (Screenplay)
Stars: Paul Dano, Zoe Kazan & Annette Bening

Source (imdb)