Displaying 20 results from an estimated 2000 matches similar to: "select options for HABTM?"
2005 Dec 24
3
Avoiding HABTM field clobbering?
>From the docs:
"Note that any fields in the join table will override
matching field names in the two joined tables. As a
consequence, having an "id" field in the join table
usually has the undesirable result of clobbering the
"id" fields in either of the other two tables."
I do have an ID field in the join table, and as a
result it''s clobbering the ID
2005 Dec 28
4
undefined method `include''
I''m getting this error in Rails:
undefined method `include'' for
#<MenusController:0x408efd1c>
The offending code is:
require "rexml/document"
include REXML
I see there may be a problem with GCC 4 on OSX, but
I''m using Redhat with GCC 3.2.
http://weblog.rubyonrails.org/articles/2005/12/22/is-gcc-4-0-incompatible-with-ruby-on-os-x-and-elsewhere
2006 Apr 04
1
habtm and options_from_collection_for_select [1.0.0]
I ran into a problem using options_from_collection_for_select :
ActiveRecord::AssociationTypeMismatch (Topic expected, got String):
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/
active_record/associations/association_collection.rb:128:in
`raise_on_type_mismatch''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/
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 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
2005 Nov 06
11
Ideal Rails / Apache config?
Hi All,
Just about to set up RoR on our server and was wondering what the
ideal setup for RoR is these days? Apache 1? Apache 2? fCgi?
Any guidance would be helpful!
Thanks,
-Adam
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 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
2005 Dec 01
12
Difficult process of restarting SCGI, Lighttpd, Apache, sessions
I''ve managed to get Rails working using Apache->Lighttpd->SCGI. Restarting everything is really
difficult. This appears to be the process:
- stop apache
- stop lighttpd
- stop scgi
- make sure scgi still isn''t running (it sometimes does) - if it is, kill it
- delete all session files (they often cause permission errors)
- start scgi
- start apache
- start lighttpd
- cross
2006 Jan 21
4
Ruby processes consuming 1,000 megs of swap space
Hi all. The subject pretty much says it.
I''m running on a VPS-style shared server at pipespring.com. I''ve got Typo
setup, and have been running it fine for about a month.
However, today I got an e-mail from my host saying they disabled Ruby (chmod
000) because it was using waaay too much swap space.
I haven''t changed anything with my server at all (Rails or otherwise)
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 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
2005 Nov 22
11
Building a conditions clause (for find) of multiple optional params?
I want to be able to find items according to various params - category_id, member_id, type_id,
rating, etc. What I have now is something like:
if(@params[''category_id''])
@items=Item.find(:all, :conditions=>["category_id=?", @params[''category_id''])
elsif(@params[''category_id''] and @params[''member_id''])
2006 May 05
1
testing for flash.now values
Is there any way in a functional test to get the value of the flash hash
if the value was set using flash.now? It doesn''t appear to be visible in
flash in the test. Example:
Controller:
def index
flash.now[''notice''] = ''this is the index''
end
Functional Test:
def test_index_flash
get :index
assert_equal ''this is the index'',
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 Jan 03
5
Are cache sweepers used?
After drawing many virtual blank stares in the IRC channel and finding
zero results on the wiki for ''sweeper'' I''m left to wonder whether
these are actually officially supported, or are on their way toward
being deprecated. Is there a better way of expiring caches on model
saves and deletions?
Sincerely,
Tom Lieber
tom@alltom.com
http://AllTom.com/
2005 Nov 21
10
Anybody using SCGI in production?
Or does anybody prefer fastcgi/fcgi? I''m using webrick for development, but plan on using scgi
when I switch to production (because it appears to be an update to fastcgi, and I couldn''t get
fastcgi working anyhow).
thanks
csn
__________________________________
Yahoo! Mail - PC Magazine Editors'' Choice 2005
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 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 30
1
What is .Instance?
With observers, you have to do (according to AWDWR):
ItemObserver.Instance
What is ''.Instance''? I''ve looked in both the Rails and Ruby docs and
don''t see any mention. I presume it''s like ''new''?
thanks
csn
--
Posted via http://www.ruby-forum.com/.