search for: most_recent

Displaying 5 results from an estimated 5 matches for "most_recent".

2008 May 13
6
Testing that named_scope is defined
Hi guys, I''m just beginning to use RSpec and I ran into the issue of testing a named_scope. I''m not actually trying to test its behavior, as it''s not my code, but I wanted to test at least that it''s defined. I tried doing this: describe Post, ".most_recent" do it "should be defined" do Post.method_defined?(:most_recent).should be_true end end But it always fails, even though it *is* defined. Any idea on how to test this? Thanks a lot! Cheers, -- Helder Ribeiro ProFUSION Embedded Systems http://profusion.mobi "If I h...
2007 Aug 09
2
trying to find records that haven't been updated in 2 weeks
My app has some students that have attendances. I''m trying to find students who have not attended class in the last 2 weeks. Here is my code that is not working: students = @school.students.active @missed_attnd = [] students.each do |student| unless student.attendances.empty? @missed_attnd << student if student.attendances.first.date <= Date.today - 2.weeks end end An
2010 Dec 02
0
Thinking Sphinx sorting problem
...page => 5, :sort_mode => :extended, :order => Application::Search::SortBy::SPHINX[@sort]) # this gives me sql string to sort by @applicants = @applicant_ids.empty? ? [] : Applicant.find(@applicant_ids, :select => "applicants.*, MAX(applications.created_at) AS most_recent", :joins => [:applications], :group => "applicants.id", :order => Application::Search::SortBy::VALUES[@sort]).to_a # this gives me sql string to sort by render :action => ''index'' end ----------------------------------------------...
2006 Mar 20
7
error using feedtools
I performed a gem install feedtools, I then added these 2 lines to my environment.rb: require ''rubygems'' require ''feed_tools'' I then added this method in my controller: def rss @post = Post.most_recent feed = FeedTools::Feed.new feed.title = ''Recent Rambles'' feed.subtitle = ''random thoughts by me'' feed.author.name = "Charlie Bowman" feed.link = "http://www.recentrambles.com/rss" feed.entries << FeedTools::FeedI...
2011 Aug 24
3
Creating new variable with maximum visit date by group_id
Dear R users, I am encoutering the following problem: I have a dataset with a 'unique_id' and different 'visit_date' (formatted as.Date, "%d/%m/%Y") per unique_id. I would like to create a new variable with the most recent date of visit per unique_id as shown below. unique_id visit_date last_visit_date 1 01/06/2010 01/06/2011 1 01/01/2011 01/06/2011 1