helper - Rails Routing and link_to -


it's little late here maybe trivial question i'm missing simple. when click button (with link_to) created following gets appended url:

%23<actionview::helpers::formbuilder:0x3ef1fd8> 

why this, , how can prevent this? again, apologize if shallow question. can post more information regarding routes , whatnot if needed.

thanks!

edit: more information requested.

view:

<%= link_to "index", welcome_path(f), :class => 'button' %> 

with f being part of form_for loop. think i'm passing wrong parameter i'm unsure.

relevant route:

get "index" => 'welcome#show', :as => 'index' 

update:

thanks everyone. ended getting working pluralizing controller (i don't know why didn't have before) , utilizing welcome_url instead. seemed trick.

check out first example , paragraph in rails api docs actionview::helpers::formbuilder:

<%= form_for @person |f| %> name: <%= f.text_field :name %> admin: <%= f.check_box :admin %> <% end %> 

what saying f represents instantiated formbuilder object passing welcome_path method in link_to helper.

typically, not mix #index , #show in routes. depending on want use welcomescontroller for, might want route root_path welcome_index:

get "welcome/show" => 'welcome#show', :as => 'welcome' root 'welcome#index' 

you should run: $ rake routes in terminal idea of path view helpers can use in app.

maybe you're trying send users personalized welcome page. have corresponding link_to helpers best this:

<%= link_to "show", welcome_path(@user.id), :class => 'button %>  <%= link_to "index", root_path, :class => 'button' %> 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -