I'm working with a simple select like this:
<%= select(@file, @file.file_id, File.all.collect {|p| [ p.name, p.id ] }) %>
However, I would like to add some conditions to that "all"...
for example
开发者_如何转开发"id != @file.id"
(I don't want the current file to be shown in the select list).
how can I do that?
Thank you!
Try
File.find(:all, :conditions => ["id != ?", @file.id]).map {|p| [ p.name, p.id ]}
精彩评论