Hello,

I'm trying to create a find statement that should find an element
which start_date and end_date are within Time.now. If I for example
have an object with a start_date of 2011-05-04 and end_date of
2011-05-19, the find statement should find the elment(s) that are
within that time peroid. My code looks like this:

def current_tee
      @current_time = Time.now
      @current_tee = Tee.find(:conditions => [
        "id = ? AND featured => true AND start_date > #{@current_time}
AND end_date <= #{@current_time}", params[:id]
      ])
end

And:

def show
    @tee = current_tee
    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @tee }
    end
end

I keep getting this error: Couldn't find Tee without an ID.

Any tips on how to solve this?

Thanks!
// Anders

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to