Is it possible to set the background image programatically?

I know how this can be done using css however this sets and fixes the background image. I have a model of books each with an image of the book and I would like to set the background to the book's image when the user fetches the book record.

```
def show
  @book = Book.find(params[:id])
  @image = @book.image
  # set the background image to @image
end

```