Displaying 20 results from an estimated 100000 matches similar to: "How to change page "timeout""
2006 Jan 11
2
map.connect - redirect with 302?
Is it possible to write map.connect rules in route.rb
that externally redirect (HTTP 302) to other actions?
thanks
csn
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
2006 Feb 08
1
routing: requiring requirements for non-existent params?
With this route:
map.connect ''items/:subject/:id'',
:controller=>''items'', :action=>''show_redirect'',
:requirements => {:subject => /.+/, :id => /\d+/}
Is it possible to have it match these URLs:
items/biology/123
items/chemistry/234
items/math/456
But not these:
items/new
items/list
...
The problem is that :requirements only
2006 Jan 11
2
Handling ''recognition failed''?
How can I handle ''recognition failed'' errors so they
act like typical 404 errors? By displaying a message,
page and/or redirecting.
thanks
csn
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
2006 Jan 21
6
Redirecting in a view?
Is there a way to do this in a view?
<% redirect_to ''http://url.com'' %>
All I can think of is outputting a link and using
Javascript to click it, or probably do something like
''doc.location(url)''.
csn
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
2006 Feb 13
2
categories and admin/categories - different controllers and templates?
Is there some way to have these two sets of URLs use
totally different controllers and templates?
categories/list
categories/show/1
admin/categories/list
admin/categories/edit/1
admin/categories/destroy/1
admin/categories/update/1
Besides, of course, using different controller names
;). The first URL is publicly accessible, while the
second contains admin functions. Also, with the
second,
2006 Feb 09
2
select options for HABTM?
I''ve looked through the docs and the wiki and can''t
figure out how to go about generating select options
and the update function for an item that has a HABTM
relationship.
I have a ''parks'' table and the park model has a HABTM
to the ''states'' table. On the park edit page, I''d like
a multiple select box to appear with all states show,
2006 Jan 14
2
I think options_for_select is backwards
With a hash such as:
stuff = {''1''=>''desc 1'', ''2''=>''desc 2'', ''3''=>''desc 3''}
options_for_select(stuff) will output:
<option id="desc 1">1</option>
<option id="desc 2">2</option>
<option id="desc 3">3</option>
2006 Jan 12
1
File Upload from URL?
Rather than having a file upload field, I want to have
a text field where a URL can be specified, then get
the file from the URL and treat it like a typical file
upload (presumably saving it in /tmp). Anybody know
how to do this?
Thanks
csn
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
2006 Feb 07
17
Easy way of dealing with nil properties in templates?
Is there an easy way to deal with nil properties in
templates? All I''m aware of are these methods, and
it''s quite tedious and surely violates DRY.
<%= @member.name unless @member.name.nil? %>
<%= @member.name.to_is %>
<%= "#{@member.name}" %>
csn
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the
2006 Jan 16
0
Methods for clearing page caches?
Here''s what I use, in a crontab entry:
*/30 * * * * find
/var/www/html/rails/public/categories/ -mmin +60 -exec
rm {} \;
I''d also like to remove empty directories, which are
easy enough to find with the ''-empty'' param, but rmdir
trips on non-empty parent directories which it finds
before children, and I''m not sure if I want to use ''rm
2006 Jan 14
12
Dedicated Host Recommendations?
I currently have a dedicated server at ev1servers, but
it''s getting rather antiquated (Redhat 9) and am
looking to upgrade. I''m thinking about serverbeach.com
- one of their CentOS servers. Anybody have any
recommendations for dedicated servers on which to run
Rails? Hopefully less than $200/month.
Thanks!
CSN
__________________________________________________
Do You Yahoo!?
2006 Feb 13
1
Paginate @member.items?
Is there a quick and easy way to paginate something
like @member.items (Member with has_many :items)?
Right now I do in the controller:
@item_pages, @member_items = paginate :item,
:conditions=>["member_id=?", @member.id],
:per_page=>25,
:order=>''datetime desc''
It''d be more DRY if this was possible:
@item_pages, @member_items = paginate
2006 Feb 07
4
ruby-forum.com problems?
Anybody else experiencing problems accessing
ruby-forum.com ? For the past week or so I''ve mostly
not been able to access it. It either never loads, or
displays a 500 error message. I prefer it though to
direct email, or the Mailman archives.
csn
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
2006 Feb 04
4
Page caching feeds and cache file extensions
I have a feeds controller which generates RSS and Atom pages. I put
''caches_page :show'' in it. The problem is that the pages are saved with
an html extension. As a result, browsers display the cached feeds as
HTML rather than XML, and feed validators complain.
There''s an option to set ''Base.page_cache_extension'' globally, but I
don''t want
2006 Feb 07
1
AWDWR: NameError (uninitialized constant UnknownAction) in rescue_action_in_public
I copied (and modified) this code from AWDWR:
def rescue_action_in_public(exception)
case exception
when ActiveRecord::RecordNotFound,
ActionController::UnknownAction
render :template=>''/error'', :layout=>''application'',
:status=>''404 Not Found''
else
render :template=>''/error'',
2006 Feb 13
0
has_many finder_sql #{id} single/double quotes voodoo
I never would have figured this out in many moons:
has_many :subscribers, :class_name => "Person",
:finder_sql =>
''SELECT DISTINCT people.* '' +
''FROM people p, post_subscriptions ps '' +
''WHERE ps.post_id = #{id} AND ps.person_id =
p.id '' +
''ORDER BY p.first_name''
Variable
2006 Feb 14
0
Preserving seconds fraction in PG timestamps when updating?
I have this code:
Link.find(params[:id]).toggle!(''active'')
Before it, its timestamp is:
2005-11-20 20:45:48.741973-07
After:
2005-11-20 20:45:48-07
Why does Rails take it upon itself to truncate the
seconds fraction? How can I get Rails to not change
it?
Thanks,
csn
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best
2006 Jan 10
0
Is accessing models in views bad?
I do it because:
1. Different retrieved records use different
variations of the same template, and may want
more/fewer/different queries and present them
differently. Plus templates can display whatever they
want and not have to rely on the controller to assign
it data. e.g. index1.rhtml can retrieve and display
categories, news, calendar; index2.rhtml can retrieve
and display categories, news,
2006 Jan 24
0
to_formatted_s(:rfc822) doesn''t work
I do ''@item.datetime.to_formatted_s(:rfc822)'' and it
outputs:
2003-08-06T04:12:00-0600
'':db'' doesn''t work either, but '':short'' does. How can
I output rfc822 without actually putting all that
awful % code in my templates? I''ve also tried this in
environment.rb, but it still doesn''t work:
2005 Dec 13
0
Splitting records into multiple columns (can this code be improved?)
I have an array of categories, and I wanted them split
up into two columns in tables:
category item_count | category item_count
category item_count | category item_count
category item_count | category item_count
category item_count | category item_count
...
Here''s the template code:
<table>
<tr valign="top">
<td width="50%">
<table