Remote: true error using in RAILS, for POST of a JS file

0

I have a problem with my code, I want Rails to remote: true from "Login" with a class and an id as below, but the server passes a GET, but I want it to look in the controller format.js to send a POST type JS function, I need to know if the code of my view / index.html.erb below is correct:

In view / index.html.erb

no controller: class HomeController < ApplicationController

  def index
    respond_to do |format|
        format.html
        format.js { }
  end
end

end

    
asked by anonymous 11.11.2016 / 22:23

1 answer

1

The question was a bit confusing, but what I understood was that you want the index method to be POST instead of GET .

By default the index method is used for GET requests. So what I recommend is you create another method and declare it in your routes.rb it file as a POST. And this method can give render method index

def search
     render :action => :index
end
    
14.11.2016 / 18:45