search for: beginning_of_month

Displaying 6 results from an estimated 6 matches for "beginning_of_month".

2009 Apr 07
4
/lib daemon folder: how do i add a module into the daemon?
...false end while($running) do # Replace this with your code get_current_time ActiveRecord::Base.logger.info "This daemons is still running at # {@current_time}.\n" sleep 5 end contents of basic_functions module BasicFunctions def get_current_time #@current_time = Time.now.beginning_of_month + 27.days #@current_time = Time.now.beginning_of_month + 13.days @current_time = Time.now end def get_time_period get_current_time @absmid = @current_time.beginning_of_month + 14.days @midperiod = @absmid - 2.days if @current_time >= @absmid @begin_bid_time = @absmid @end...
2012 Apr 12
6
beginning_of_month problem
Rails 2.3.2, Ruby 1.9.3 I want to get all records for one month from charges table. recs = Charge.where(["date >= ? and date < ?", t.beginning_of_month, t.next_month.beginning_of_month]) and this transforms into this query on PostgreSQL SELECT "charges".* FROM "charges" WHERE (date >= ''2012-03-31 22:00:00.000000'' and date < ''2012-04-30 22:00:00.000000'') Which is wrong. Dates should h...
2008 Apr 22
0
rspec model class methods
...hod below grouped_by_months and started to write a spec. idea 1: {{{ before do @comment = Comment.new @comment.stub!(:created_at).and_return(Time.now -2.days) end it ''should return comments grouped by month'' do group_terms = lambda{|comment| comment.created_at.beginning_of_month } Comment.should_receive(:find).and_return([@comment]) [@comment].should_receive(:group_by).with(&group_terms).and_return([[@comment]]) Comment.grouped_by_month end }}} idea 2 {{{ before do @comment = Comment.new @comment.stub!(:created_at).and_return(Time.now -2.da...
2008 Mar 06
4
Active Record Question
Hi- Say I am returning some collection of DateTime items and I only want to compare the month. Is there a way to do this directly in the find? Something like this... @coll = Collection.find(:all, :conditions => ["date.month = ?",Time.now.lat_month]) Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google
2011 Mar 14
0
Problems with viewing my calendar
...h @visitors = Visitor.all @date = params[:month] ? Date.parse(params[:month]) : Date.today end end ------------ View: ------------ <h1>Calendar</h1> <div id="calendar"> <h2 id="month"> <%= link_to "<", :month => (@date.beginning_of_month-1).strftime("%Y/%m") %> <%=h @date.strftime("%B %Y") %> <%= link_to ">", :month => (@date.end_of_month+1).strftime("%Y/%m") %> </h2> <% calendar_for(@visitors, :year => @date.year, :month => @date.month) do |cal...
2008 Oct 14
4
replace_html not working
hallo, everyone can anybody help me? i did add my code under ENGINES as a module in a project. before the change , all worked . and the differenz between both is only about application''s environment, before is Ruby version 1.8.6 (i486-linux) RubyGems version 1.1.1 Rails version 2.0.2 Active Record version 2.0.2 Action Pack version 2.0.2