Skip to content

Instantly share code, notes, and snippets.

@eqdw
Created June 21, 2009 17:34
Show Gist options
  • Save eqdw/133575 to your computer and use it in GitHub Desktop.
Save eqdw/133575 to your computer and use it in GitHub Desktop.
def index
@bugs = nil
if request.post?
mappings = Hash.new{|k,v|v}
allowed_user_attrib = [:company_name, :name]
allowed_bug_attrib = [:submitter]
user_attrib = params[:user].reject{|k,v| ! allowed_user_attrib.include?(k)}
bug_attrib = params[:bug].reject {|k,v| ! allowed_bug_attrib.include?(k)}
if user_attrib
user = User.find(:first, :conditions => user_attrib)
bug_attrib.merge!({:user_id => user})
end
@bugs = Bug.find(:all, :conditions => bug_attrib)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment