Displaying 20 results from an estimated 40000 matches similar to: "Problem with :action => 'destroy' in url_for"
2005 Aug 08
1
url_for()/link_to() Broken under Webrick?
After successfully getting my "productized" sites into production, I decided it
was time to get the development environment working (i.e. through "script/server
--site=foo"). However, when I go to run a site under Webrick, I get two major
errors:
(0) Routes don''t seem to work properly, specifically the root-level route gets
ignored. Instead,
2009 Jan 12
0
url_for, routes, and the current url
I need to generate 2 types of URL and have defined my routes as:
map.country_yes
"/:country/
yes", :controller=>"posts", :action=>"country", :yes=>true
map.country_no
"/:country/
no", :controller=>"posts", :action=>"country", :yes=>false
map.yes "/yes", :controller=>"posts",
2007 Mar 19
2
Controller url_for modifies request object?
Hi,
In my controller, I do something like this:
MyMailer.deliver_signup_notification(url_for(:subdomain =>
account.subdomain, :controller => ''hello''))
And a few lines later:
redirect_to :action => ''index''
Much to my confusion, the redirect routes me to the subdomain used in
the url_for. I''ve tried
redirect_to :action =>
2006 Apr 17
1
problem with reverse mapping (url_for problem)
I modified my routes to that you can reach my index action by just
typing in the site name (ie www.mysite.com). I did this by:
map.connect '''', :controller => "pragmatic"
I need to be able to do a url_for(:controller => ''pragmatic'') or
url_for(:controller => ''pragmatic'', :action => ''index'') and have
2006 Mar 31
1
url_for leave out ''index'' action
I''m trying to reduce the size of urls in my app and i was wondering how i
can get all links to an index action to leave out the ''index''. In my
routes.rb, i have it setup to recognize the controller and default to the
index action.
But is there a way to make it so that the ''index'' portion in the url is not
shown to the user? This is mostly a concern
2006 Sep 07
5
url_for always escape string.
according to the documentation, only the url_for from ActionView escape
the
URL.
which happens on this line
escape ? html_escape(url) : url
and can be prevented by passing :escape =>
false to url_for.
still according to the documentation, the url_for from ActionController
is not supposed to escape the url.
BUT IT DOES.
at the moment of this line
escape ? html_escape(url) : url
url has
2005 Dec 22
2
routes and url_for
Hi, All.
I try to relocate controllers. Admin space controlers moved to
/app/controllers/admin and user space controllers to
/app/controllers/user
In routes.rb I use
map.connect ''search'', :controller => ''user/search''
that correct I see.
But when I want to use start_form_tag or simply url_for, that used in
start_form_tag, I do not know how generate url
2009 Jun 17
1
url_for and rake routes differences
I am caching and expiring pages/actions/fragments in my code and I''ve
come across a really frustrating problem
In my routes I have prefixed all controllers with the :locale. This
works well for the most part. When I cache a page/fragment it is
cached to /en/whatever etc... as expected
However when I try to expire the page/fragment the locale is not
prefixed to the url but added as an
2006 Jul 16
0
Why does belongs_to handle "conflicts" this way?
When you define belongs_to in a model, you can either access
association or association_id. I was wondering how Rails would handle
things if you set each one to be different.
I made two simple models:
class Foo < ActiveRecord::Base; end
class Bar < ActiveRecord::Base
belongs_to :foo
end
Now here''s a script/console session.
>> f = Foo.create
=> #<Foo:0x270ec10
2006 Jun 10
0
opposite of url_for()?
Hi,
I have a string in a controller that represents a url for my website.
For example the string might be
/cont/act/id
and I want to break this up using the routes defined in my
config/routes.rb file so that I get a hash like
{:controller => ''cont'', :act => ''act'', :id=>''id''}
How can I access all of the information stored in
2006 Sep 22
1
url_for params
Hi,
url_for has a nice way of using the current ''params'' object to fill in default
parameters in a route. For example,
map.connect '':controller/:action/:id/''
with <%= url_for :action => ''my_action'' %> will redirect to the current
controller. All very good.
However, I sometimes want a url_for() which includes current parameters
2005 May 21
0
How can I get a post-Routing translated url_for?
Is there a way to ask the Route system what controller and action
mapping will be used, given a hash containing :controller and :action?
I am trying to generalize the case where there is a button bar (e.g.
tabbed pages) having one image shown if you are presently visiting
that page, and another shown if you are not presently visiting that
page (e.g. an "active" and an
2006 Aug 12
1
url_for and :defaults
Hello,
in my routes there are (just for testing):
map.connect '':controller/:id/:action'', :defaults => {:action => ''alma''}
in my controller:
def alma
render :text => url_for(:id => 123)
end
so I go to:
http://localhost:3000/music/store
which generates:
http://localhost:3000/music/store/123/index
Where the
2007 Oct 18
1
Problem with url_for
Hey everyone,
I have an Asset class that extends AR::Base, and a series of
subclasses of Asset (Stylesheet, Layout, etc.)
I have REST routes set up with assets nested under sites.
when doing something like url_for([@site, @asset]), if @asset is a
Stylesheet, I''ll get an undefined method ''site_stylesheet_path'',
where what I really need is site_asset_path.
2006 Jun 19
0
url_for missing out parameters?
Having a bit of an issue with url_for
The current page I''m on has a named route as follows:
map.some_page ''page/:id/:range'', :action => ''the_action''
All looks fairly normal. I have an url_for on this page to make a link
to another page as so:
url_for(:controller=>''other'', :action=>''display'', :id=>5,
2008 Apr 05
0
url_for + :canvas => false weirdness for non resource controllers
I noticed something strange in my app today. It appears that the
extra canvas path appended in url_for is back but only for
controllers that are not resources. Here is an example I have in my
site:
campaigns is a resource
checkout is not
# With the canvas false flag
(rdb:1) @controller.url_for(:controller => ''campaigns'', :action =>
''show'', :id
2006 Oct 22
2
url_for In a Component?
When I try to use url_for within a component I get the following:
NoMethodError in LinkController#get_links
undefined method `url_for'' for Navbar::LinkController:Class
The API docs show url_for as a public method of ActionController::Base.
Since my component is derived from ActionController::Base shouldn''t
url_for be available within the class?
Any ideas?
Thanks!
-
2007 May 11
1
url_for and capitalization..
i am having a very weird problem with url_for..
i have been using this for several version of rails, but recently, i had
a problem..
it seems as though url_for is causing the results to be returned in
lower case..
if there are uppercase letters in the arguments, they result is all
lower case. obviously, this is a problem as the urls don''t work anymore.
the other oddity is that when i
2005 Mar 06
2
Using url_for in ActionMailer templates
Hi All
I am just adding some basic e-mail notices to my Rails app using
ActionMailer, and have one small issue. I want to provide a
confirmation URL to users who sign up for an account. I can obviously
just hardcode the URL and append the confirmation code to it, but I''d
much rather be able to use something like:
url_for(:controller => ''authentication'', :action
2007 Mar 03
5
url_for and arrays parameters (diffs between rails 1.1.6 and 1.2.2)
Hello,
I posted this to the main rails list
(http://www.ruby-forum.com/topic/99845), but haven''t received any
replies yet, so maybe this question is better suited here. Sorry if
this has been brought up before, I couldn''t find any previous
discussion on this.
To summarize the post...
When using the latest Rails (1.2.2)
I''m passing an array to url_for like so...