Hello! At the moment I try to do following:
I created several partials (i.e. _show_signature.html.erb) for my user. Now I want to show them on clicking a link. In my user controller, I created a new action:
def show_signature
@is_on_show_signature = true
end
def show_information
@is_on_show_information = true
end
on my user show.html.erb i coded this:
<% if @is_on_show_information %>
<%= render :partial => 'show_information' %>
<% elsif @is_on_show_signature %>
<%= render :partial => 'show_signature' %>
<% end %>
and in my "navigationbar" i wrote:
<ul>
<li class="profile-tab">
<%= link_to 'Information', show_information_path %>
</li>
<li class="profile-tab">
<%= link_to 'Signature', show_signature_path %>
</li>
</ul>
In my routes.rb I wrote:
map.show_information '/user-information', :controller => 'user', :action => 'show_information'
map.show_signature '/user-signature', :controller => 'user', :action => 'show_signature'
now my problem:
clicking on my "information" link will redirect me to http://localhost:3000/user-information (cause I told him this path in routes.rb - I think) and I get an error:
uninitialized constant UserController
But that's not what I want... My user show path is something like:
http://localhost:3000/users/2-loginname
(by coding
def to_param
"#{id}-#{login.downcase.gsub(/[^[:alnum:]]/,'-')}".gsub(/-{2,}/,'-')
end
in my user model)
I want to link to somethink like http://localhost:3000/users/2-test/user-information. Any ideas how it will work? Any ideas why I get this error?