GET and POST problem in URL access

Hi,

My controller code is,

class MyController < ApplicationController
def my_method
puts “Inside my method”
end
end

In my routes.rb:
map.resources :my_controller, :collections => {:my_method => :post}

I have implemented the user authentication also. After login, when I try
to access the URL ‘http://localhost:3000/my_controller/my_method’ it
shows the following error.

Unknown action
No action responded to show

This is because GET request is sent to the controller. It must be POST.
How can I make the method as POST?

Thanks in advance…

Solved the problem. I had made a mistake in passing URL.

The URL should be ‘http://localhost:3000/my_controller/my_method/1’.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs