similar to: Reading from Session in routes.rb?

Displaying 20 results from an estimated 10000 matches similar to: "Reading from Session in routes.rb?"

2006 Mar 16
2
Arrays of Model Objects, Intersections, Object Identification... ?
Hi all, Hope you can help me with understanding how Ruby / Rails treats arrays full of objects. Let''s say I have to arrays of objects. Both are the same kinds of objects. tomatoes = Fruit.find(:all, :conditions => [ ''tomato = ?'', true], :limit => 10) fruits = Fruit.find(:all, :limit => 10) And I want to create an array of these objects called @my_fruits,
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",
2006 Jul 08
0
Different URL generation in regular and named routes.
Obviously I am missed something, but why the way a path is generating using named routes is a little bit different from using regular url_for? 1. Parameters from current request did not affect named routes, the way it is in the url_for. 2. only_path=>false by default in named routes. It is true by default whe using *_path instead of *_url, by why not to set it true by default in *_url and
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
Routes Misunderstanding
Hi there, I seem to be misunderstanding routes a little bit as I can''t get the behavior I''m expecting from the following. My goal is to get "/forums/1" from the code <%= url_for :id => forum.id %> which is being called from a view associated with a controller named "Forums" and the "index" action. I have the following routes:
2006 Jun 14
1
page caching with custom routes
hi , I''m having problems with expire_page with custom routes i''ll show some code blog_controller --------------- def clear_cache_rss_artikels expire_page url_for(:controller => "xml",:action => "rss_artikels") end this is called when a new article is posted or edited or destroyed xml_controller --------------- class XmlController <
2006 Sep 05
1
Named routes and current_page? incompatibility
Hi, I have some named routes defined e.g. map.public and wish to use link_to_unless_current() to disable link. However, as I''ve seen from forum discussions and the API doc, the issue lies with the fact that the named_route_url() method generated by a named route does not default to only_path = true like url_for. Therefore, the current_page? within link_to_unless_current() will not
2006 Dec 07
2
backgrounDRb problems with results and MiddleMan
Hi there, I''ve been experimenting with implementing BackgroundDRb in my rails app but am running into some problems. The primary problem I''m getting is in cleaning up worker threads, or getting any kind of response out of worker threads. If try using the response function/hash in my Worker the worker will not execute reporting that response is an unknown variable or function.
2006 May 13
3
Non-customizable parts in the routes hierarchy-chain.
Hi I created a custom route that looks like this: map.connect '':controller/:table/:action/:id'' Hierarchically, :table is above :action and :id. So, if we call ActionController::Base#url_for with an argument :table=>nil, we''re supposed to get a url with :action and :id set to nil as well. However, this is not the case: url_for(:table=>nil) from
2006 May 08
0
testing named routes
Hello, I''m trying to test routes named within a map.with_options statement. I have in routes.rb: map.with_options :controller => ''films'' do |f| f.overviews ''films/:index'', :action => ''index'', :requirements => { :index => /index(artist|date|title)\.html/ }, :index => ''new'' etc... end and
2006 Jul 11
0
assert_redirected_to not recognizing routes
I''m getting a weird error in a call to assert_redirected_to in one of my functional tests. Here is the test: def test_signin admin = users(:adminuser) post :signin, {:login => admin.email, :realpass => @password} assert_redirected_to :action => ''list'' # failure happens on this line assert_equal admin.id, session[:user].id end The error
2006 Mar 27
3
regular expression matching in routes.rb
All, I have a route specified as: map.connect '':folder/:filename'', :folder => /htmlfiles/, :controller => "eSimply", :action => "preview_HTML" I expect it to invoke the "preview_HTML" action in the "eSimply" controller. Given an argument of "htmlfiles/xyz.html", it keeps saying that it can''t find an
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 Apr 20
0
Custom path overriding - routes.rb
I want to be able to have custom URL paths to some of my data. For example, I might have some entries in my "item" table like: id=1, title="Test", path="/test.html", content="some test content..." id=2, title="Example", path="/another/example/", content="some example content..." id=3, title="Some more",
2006 Jan 31
3
Lost in routing
I''m trying to create a modules based system where my controllers are all under modules. So the structure looks something like: app/ controllers/ message/ news_controller.rb email_controller.rb library books_controller.rb pictures_controller.rb home_page_controller.rb Each of those controller has
2010 Jul 27
0
Using an ActiveRecord model in routes.rb
Is it potentially dangerous to use an ActiveRecord model in routes.rb? Here''s a line from our routes.rb file: > map.resources :registrations, :requirements => { :id => User::USERNAME_REGEXP } Registration#to_param returns the User''s username. User::USERNAME_REGEXP is just a regex that matches one or more valid username characters. This route works as expected, but my
2012 Feb 01
0
Rails 3.1 form & routes.rb [newbie]
Hi all, maybe is a newbie question anyway 1. I create de rails app with # rails new {my app} 2. after I add some gem to my Gemfile source ''http://rubygems.org'' gem ''rails'', ''3.1.1'' gem ''sqlite3'' gem ''simple_form'' gem ''execjs'' gem ''therubyracer'' # Gems used only
2007 Apr 30
0
Cache routes.rb in development?
My routes.rb files uses resources and building the routes for each request takes a while. Is it possible to cache the routes during development, like they do in production, but without caching everything else? Thanks for your help. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google
2008 Jul 19
2
renaming routes.rb
When you create a new rails app the default home page says to rename routes.rb. I tried this, but when I run script/console or script/server I get an error saying the routes.rb file can''t be found. If you rename this file is there an environment variable holding the location elsewhere in the application? -- Posted via http://www.ruby-forum.com/.