It's a little late here so maybe this a trivial question where I'm missing something simple. But when I click a button (with link_to) I created the following gets appended to my URL:
%23<ActionView::Helpers::FormBuilder:0x3ef1fd8>
Why is this, and how can I prevent this? Again, I apologize if this is a shallow question. I can post more information regarding routes and whatnot if that is needed.
Thanks!
Edit: More information as requested.
View:
<%= link_to "Index", welcome_path(f), :class => 'button' %>
with f being part of a form_for loop. I think I'm passing the wrong parameter but I'm unsure.
Relevant Route:
get "index" => 'welcome#show', :as => 'index'
Update:
Thanks for the help everyone. I ended up getting it working by pluralizing my controller (I don't know why I didn't have that before) and utilizing welcome_url instead. That seemed to do the trick.
Check out the very first example and paragraph in the Rails API docs for ActionView::Helpers::FormBuilder:
What this is saying is that
f
represents an instantiated FormBuilder object that you are passing to thewelcome_path
method in yourlink_to
helper.Typically, you would not mix #index and #show in your routes. Depending on what you want to use the
WelcomesController
for, you might actually want to route yourroot_path
towelcome_index
:You should run:
$ rake routes
in the terminal to get an idea of path view helpers that you can use in your app.Maybe you're trying to send users to a personalized welcome page. You could have something like this for your corresponding
link_to
helpers would look best like this: