Forum: Ruby on Rails path problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
32edf22df6932b252d7be5a1b9b766c9?d=identicon&s=25 Stephen Fagan (railsman)
on 2009-05-03 21:46
Hi all,

I am trying to create a mobile version of my application and for example
for the mobile forums in routes.rb is:

 map.resources :forums,
                :controller => 'mobile/forums',
                :path_prefix => '/mobile',
                :name_prefix => 'mobile_' do |forums|
    forums.resources :topics,
                     :controller => 'mobile/topics',
                     :name_prefix => 'mobile_' do |topics|
      topics.resources :posts,
                       :controller => 'mobile/posts',
                       :name_prefix => 'mobile_'
    end
  end

In the topics index, to post a topic:

<p>
<% if is_logged_in? -%>
  <%= link_to 'Post New Topic', mobile_new_forum_topic_path(:forum_id =>
@forum) -%>
<% else -%>
  <%= link_to 'Login to post a new topic', login_url -%>
<% end -%>
</p>

The problem is the path mobile_new_forum_topic_path. I am getting an
'undefined method' error. I know this is because the path is not right
but I have tried all various combinations e.g. mobile_new_topic_path,
forum_mobile_new_topic_path etc but get the same error.

Anyone any ideas?

Thanks

Steve
1e7782e67bb34c9c67ed19d5cde5f4eb?d=identicon&s=25 Tom Z Meinlschmidt (Guest)
on 2009-05-07 02:13
(Received via mailing list)
run "rake routes" command to show all possible routes and path/url names

tom

Stephen Fagan wrote:
>                      :controller => 'mobile/topics',
> <% if is_logged_in? -%>
> forum_mobile_new_topic_path etc but get the same error.
>
> Anyone any ideas?
>
> Thanks
>
> Steve


--
===============================================================================
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===============================================================================
32edf22df6932b252d7be5a1b9b766c9?d=identicon&s=25 Stephen Fagan (railsman)
on 2009-05-07 12:08
I got it sorted out. It turned out to be new_mobile_topic_path. So
obvious its frightening :@o


Thanks

Steve

Tom Z Meinlschmidt wrote:
> run "rake routes" command to show all possible routes and path/url names
>
> tom
>
> Stephen Fagan wrote:
>>                      :controller => 'mobile/topics',
>> <% if is_logged_in? -%>
>> forum_mobile_new_topic_path etc but get the same error.
>>
>> Anyone any ideas?
>>
>> Thanks
>>
>> Steve
>
>
>
> ===============================================================================
> Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
>
> www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
> ===============================================================================
This topic is locked and can not be replied to.