title: How to call a method from controller using link_to?
body: <p>I want my app to add a book to current_user when he clicks the link. My code seems to be ok, there are no errors but after user clicks the link nothing happens.</p>
  
  <p>book.rb: </p>
  
  <pre><code>has_many :book_users
  has_many :users, through: :book_users
  </code></pre>
  
  <p>user.rb:</p>
  
  <pre><code>has_many :book_users
  has_many :books, through: :book_users
  </code></pre>
  
  <p>book_user.rb:</p>
  
  <pre><code>belongs_to :book
  belongs_to :user
  </code></pre>
  
  <p>books_controller.rb:</p>
  
  <pre><code>before_action :is_admin?, except: [:book_params, :add_to_books_i_read, :index]
  before_filter :authenticate_user!
  expose(:book, attributes: :book_params)
  expose(:books)
  
  
    def create
      if book.save
        redirect_to(book)
      else
        render :new
      end
    end
  
    def update
      if book.save
        redirect_to(book)
      else
        render :edit
      end
    end
  
    def add_to_books_i_read(book_id)
      current_user.books &lt;&lt; Book.find(book_id)
    end
  </code></pre>
  
  <p>In my index view I have</p>
  
  <pre><code>ul
    -books.each do |book|
      li
        = link_to "#{book.name}", book_path(book)
        = link_to "  Add to my books", {:controller =&gt; "books", method: :add_to_books_i_read, book_id: :book.id}
  </code></pre>
  
  <p>So, what am I doing wrong? Why my method add_to_books_i_read does nothing? The table in database book_users doesn't record anything after clicking this link_to, but it works well itself (I checked via console). What can I do? How to make users add books through the method and how to call this method correctly? Every help would be appreciated, thank you!</p>