rails -- view page routing controller

Define the method, get the user's collection on the new page, and add it to the route

resource  :xxx do

  collection do 
    get :my_collections
  end
end

def my_collections                                          
  #@contracts = Contract.where('address = ?', current_user.address )
   @contracts = Contract.where('address = ?', params[:address] )
end

In the later period, user login will be added to determine the correct user to obtain the user's address or telephone. It is also possible to use params[:address]

Guess you like

Origin blog.csdn.net/Toml_/article/details/131591165