D
D
Dmitry Rotaty2013-11-24 18:49:57
Ruby on Rails
Dmitry Rotaty, 2013-11-24 18:49:57

How to properly make a page jump button with rails tools?

Hello. I'm learning ruby ​​on rails, one moment is incomprehensible, because of which I can't go further. Namely:
The idea so far is this - you need to create a button on one page (home) that will send us to another page. There is a controller on both pages (empty, not a single action is written) and a view. The home page view, where the button should be, contains the code

<%= form_for :home do |f| %>
          <%= f.submit('Перейти далее') %>
      <% end %>

And the routes.rb file contains 3 lines
get 'home/home'
  root 'home#home'
  resources :input_page

input_page - the page to go to. home - from where to go.
Please tell me what and where to add.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mardy_bum, 2013-11-24
@Flamine

Try like this:

<%= form_for :home, :url => {:controller => 'input_page'} do |f| %>
   <%= f.submit('Перейти далее') %>
<% end %>

S
Snuff, 2013-11-24
@Snuff

It seems to me that the solution at the top with a form is not correct. Use the link_to helper
Most likely I am mistaken with the helper, you can see it using the rake routes command

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question