Displaying 9 results from an estimated 9 matches for "post_path".
Did you mean:
host_path
2008 Apr 30
3
pretty url
I want to write a permalink like /year/month/day/title, code is as follows:
self.permalink = "#{now.year}/#{now.month}/#{now.day}/#{title}"
in the view, I use restful url post_path(@post). And in the html source
code, the url is /posts/2008%2F4%2F30%2FTest
You can see, the ''/'' is replaced by "%2F", which is not I expect.
How not to replace the ''/'' with "%2F"?
--
My home: http://flyerhzm.com
--~--~---------~--~----~-...
2007 Jul 06
0
Removing One Element From a Serialized Form
Hi all,
I''m trying to serialize a form with the exception of one specific
element.
Serializing the form in a hash (without pulling out specific elements)
works:
<li>
<%= link_to_remote ''(Save)'', {:url => post_path(@post), :with => "$
(''post_form'').serialize(true)" }, :method => :put %>
</li>
The generated code is:
<li><a href="#" method="put" onclick="new Ajax.Request(''/posts/1'',
{asynchronous:true, evalScripts:t...
2010 Apr 22
0
How to automatically set params based on passed object when generating a route?
Hi,
having i.e. a post model that has many categories - is it possible for
member routes like i.e. post_path(post) to generate path like "/
posts/:post_category_name/:post_id" without manually passing the
category param? Does anyone know if there''s a gem or if I can simply
override the post_url method to automatically set category from post
object?
The best I could get right now is pos...
2008 Jan 21
2
multiple ids on restful action
...fying answer.
Maybe I didn''t look well enough, so any pointers to old messages
regarding this subject would be welcome too.
I need some way to pass multiple ids to a resource.
Something like /posts/13,14
If I do this I have to manually split the id on ","s in the action,
and use
post_path([post1, post2].map {|x| x.id}.join('',''))
in my views, which I think is not very nice.
If I use post_path([post1, post2]) rails uses to_param on the array
which leads to the string "13/14" which is url-encoded to "13%2F14"
but the browser just shows a / in the...
2012 Jun 26
2
Error with rake command
.../action_dispatch/routing/route_set.rb:586:in
`url_for''
/home/ms/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/routing/url_for.rb:148:in
`url_for''
/home/ms/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:213:in
`post_path''
/home/ms/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/testing/assertions/routing.rb:174:in
`method_missing''
/home/ms/Desktop/rails3/blog/test/functional/posts_controller_test.rb:39:in
`block in <class:PostsControllerTest>''
8 tests, 8...
2007 Aug 23
1
validation across controllers
...---------------------------------------------------------------------------------
class CommentsController < ApplicationController
...
def create
@comment =
Post.find(params[:post_id]).comments.new(params[:comment])
@comment.user = current_user
if @comment.save
redirect_to post_path(@comment.post)
else
# ??
end
end
...
end
-------------------------------------------------------------------------------------------------------------------------------------
I''ve got two controllers. The template for the posts'' show action
displays comments f...
2010 Apr 14
0
Rails 3 (beta3) and paths in the console
Did I miss some release note somewhere? I used to be able to, from the
Rails console, get paths and urls using:
app.posts_path or app.post_path(p)
Now, trying to do that, I get an error stating that those methods are
protected?
irb(main):001:0> app.posts_path
NoMethodError: protected method `posts_path’ called for
#<actiondispatch::integration::session:0x3bf67c0>
(Windows, Rails 3beta3, Ruby 1.9.1p378)
Thanks
--
Posted via ht...
2008 Jan 10
21
Shoulda
Hey, we''re currently using shoulda (http://dev.thoughtbot.com/
shoulda/) on a project and I saw some things that would be really nice
to see in rspec, namely the should_ methods, and especially the
should_be_restful method. Do these go against the rspec goals at
all? Or could an ambitious programmer go to town implementing these
for rspec_on_rails?
Nathan Sutton
fowlduck at
2013 Mar 15
5
link_to should have its body and url arguments reversed
I think the link_to helper method is quite confusing with its arguments
order:
link_to body, url
link_to "Click me", @person
Why is it thay way round? I want to make a "link to [the] person", so I
would expect the order to be:
link_to @person, "Click me"
It reads much more natural. You don''t "link to [the] body", you "link to