search for: polymorphic_path

Displaying 11 results from an estimated 11 matches for "polymorphic_path".

2011 Mar 02
0
polymorphic_path not getting generated
...ot;http://127.0.0.1:3001/forums/1/topics/1? page=1#posts-1" as the url. To make it polymorphic, I need the schools in the url so the url needs to change to "http://127.0.0.1:3001/ schools/1/forums/1/topics/1?page=1#posts-1". So I replaced the above line with <%= link_to t(:view), polymorphic_path([@forum_owner, forum, forum.recent_topic], :page => forum.recent_post.topic.last_page, :anchor => forum.recent_post.dom_id) %> @forum_owner and other variables are properly initialized. But this gives the error --> undefined method `school_forum_topic_path'' for #<ActionView...
2010 Sep 09
17
formtastic issue
Hello, I will try to explain it step by step :-) I just created a new rails 3 app, then I created a new controller... rails generate controller admin::users I didn''t forget to add the resources in the routes.rb file like this. namespace :admin do resources :users end Now I try to use formtastic to create the form but I get erorr that my users_path doesn''t exist?
2009 Jun 11
4
Using view helpers and route helpers in a model
...en looking around for solutions to getting view helpers working in models and for the most part I find this solution. Add the following in the model you want to use them in include ActionView::Helpers::UrlHelper include ActionController::UrlWriter However, when I try something like link_to(polymorphic_path(@node)) I get an error. "can''t convert String into Hash" This is because ''link_to'' uses ''url_for'' which is a method that both UrlHelper and UrlWriter both have which actually behave differently. so my polymorphic_path(@node) => "/nod...
2007 Jul 06
1
Edge, link_to and mocks
...g. if you have something like the following in your view (or equivalent in a helper): <%= link_to @dog.name, @dog %> as opposed to the current 1.2 syntax: <%= link_to @dog.name, dog_path(@dog) %> Using a mock_model as the ''dog'' will raise a: undefined method `polymorphic_path'' for [Dynamically generated class for RSpec example]:#<Class:0x26814f4> error - I presume due to the introspection on the @dog object to find out what kind of class it is to create it''s URL. Anyone worked around this at all, other than using the older syntax? Any ide...
2010 Sep 11
10
Having difficulty with threaded comments, using acts_as_tree
...comments/comment'', :collection => @comments %> <%#= will_paginate @comments %> <% end %> Here is what each individual comment looks like: <div id="comment <%= comment.id %>"> <%= comment.title %> | <%= link_to "Permalink", polymorphic_path([@commentable, comment]), :action => :show %> | <%= link_to "Reply", polymorphic_path([@commentable, @comment]), :action => :new %> | <%= link_to "Edit Comment", polymorphic_path([@commentable, comment]), :action => :edit %> | <%= link_to '...
2012 Aug 07
9
How do I force link_to/form helpers to use the superclass name in the path instead subclass?
I want my helpers to generate paths using a superclass instead of the subclasses. Assuming I have Owner and Member that both inherit from User, rails will use the current objects class name when generating paths: Let''s say current_user is a mod: <%= link_to current_user.name, current_user %> will generate "/mod/:id". I want to force it to generate
2008 Dec 20
3
undefined method `stories_path'
..._send__'' /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:112:in `polymorphic_url'' /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:119:in `polymorphic_path'' /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/form_helper.rb:269:in `apply_form_for_options!'' /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/form_helper.rb:248:in `form_for&...
2010 Sep 17
25
Trying to look up comment through an ID, but failing
I am trying to allow users to reply through comments by allowing users to click a reply link next to the parent comment. It will send in a parameter to the ''new'' comment view, like so: | <%= link_to "Reply", new_comment_path(:in_reply_to => comment.id) %> The form will use the :in_reply_to parameter in order to save that id as the parent id, like so:
2009 Feb 27
0
Contextually aware controllers
...g on the side that''s only relevant to the admin area) /learning_cave/pages/new - shows the same view and uses the same controller but uses a different layout and possibly some other checks that are only relevant for caves. I''ve been attempting to do this with restful routing and polymorphic_path (because I won''t know the context ahead of time) but I''m having no luck. Does anyone know if there is already anything out there that would assist with this approach? I''m trying to package all my modules as rails engines and something like this would help greatly. Cheers...
2008 Jan 21
8
Polymorphic URL helpers documentation and fixes
Yesterday I answered a question regarding polymorphic URL helpers on Core ML and noticed that the module has no documentation. I''ve documented it and rewritten unit tests using Mocha. I also optimized some of the code slightly (nothing major, though). The patch also includes two fixes by Geoff Buesing, who has done awesome work in this area in the past.
2010 Jul 27
13
3.0.0rc ActionController::RoutingError No route matches
Have been developing on 3.0.0beta4 and just updated to 3.0.0.rc. When I try to link_to() a User object that previously had worked, I get the following: ActionView::Template::Error (No route matches {:action=>"destroy", :controller=>"games", :id=>#<User ..... > Yet I have in my routes.rb file has resources :users and my "rake routes" shows: