ruby on rails - Allow method to accept an :id param -
i have created method called verify in controller (events_controller.rb), , want allow page (verify.html.erb) accept object (@event), , show of objects parameters. i'm creating show page in essence, need build special logic page don't want build show page. have created route, still error when tell find event params[:id]. actual url going /verify.(event :id) , believe should routing events/verify/(event :id).
my error
couldn't find event without id.
routes.rb
get "verify", to: 'events#verify' resources :events
events_controller.rb
def verify @event = event.find(params[:id]) respond_to |format| format.html # verify.html.erb format.json { render json: @event } end end
thanks stack!
get "verify/:id", to: 'events#verify', as: "verify"
in browser go url example:
localhost:3000/verify/1
Comments
Post a Comment