search for: end_dat

Displaying 20 results from an estimated 61 matches for "end_dat".

Did you mean: end_date
2006 Jun 14
4
Using now() to determine what should be displayed
I''m trying to create a paginated list that will take note of the "end_date" field in my table. This is what I have: @post_pages, @posts = paginate(:posts, :per_page => 10, :order_by => ''end_date'') in the controller. And for the view: <h1>Posts ending soon</h1> <ul><% for post in @posts do %> <strong>Post Titl...
2006 Jun 25
1
Sorting ferret results by column
I have the acts_as_ferret plugin installed. Everything searches great, but I would like to limit the results (i.e. by ''end_date'') and sort them (by ''end_date''). ''end_date'' is a valid column in my "posts" table. Here''s the code I have already: @posts = Post.find_by_contents(params[:query]) params[:query] comes from a form. I am replacing less efficent code th...
2006 Dec 11
1
Compute date during before_validation_on_create
Hello, - the form posted by the user have a date field - this date is begin_date, I need to compute end_date - so, added callback before_validation_on_create - in this method I do : end_date = begin_date >> 12 - unfortunately, beeing in before_validation the actual self.begin_date have not been type casted - It''s always a string - unfortunately again, I can''t put this code in befo...
2009 Aug 13
2
need technique for speeding up R dataframe individual element insertion (no deletion though)
Hi fellas, I am working on a dataframe cam and it involves comparison within the 2 columns - t1 and t2 on about 20K rows and 14 columns. ### cap = cam; # this doesn't take long. ~1 secs. for( i in 1:length(cam$end_date)) { x1=strptime(cam$end_date[i], "%d/%m/%Y"); x2=strptime(cam$end_date[i+1], "%d/%m/%Y"); t1= cam$vol[i]; t2= cam$vol[i+1]; if(!is.na(x2) && !is.na(x1) && !is.na(t1) && !is.na(t2)) { if( (x2>=x1) && (t1==t2) )...
2006 Dec 08
2
trouble using ActiveRecord classes
...e model class PublishWorker < BackgrounDRb::Worker::RailsBase attr_accessor :publication_id def do_work(args) logger.debug("PublishWorker args: #{args.inspect}") @publication_id = args[:publication_id] logger.debug("Publication id: #{@publication_id}") end_date = args[:end_date] || Time.now.utc logger.debug("End date: #{end_date}") begin logger.debug("In begin block") logger.debug("Publication.table_name: #{Publication.table_name}") logger.debug("Publication.connected?: #{Publication.connected...
2011 May 19
1
update_attributes updates data from second instance of nested form but not the first
...r, update_attributes(params[:matchup]) returns true, so there is no error. If the second was not updating I would assume something is wrong in my code in terms of attributes getting assigned to a model, but that does not seem to be the case. Parameters: { "matchup"=> { "end_date(3i)"=>"19", "end_date(4i)"=>"16", "end_date(5i)"=>"46", "rosters_attributes"=> { "0"=> { "name"=>"abc", "players_rosters_attributes"=>...
2006 Jun 15
1
callback object problem
...e the example from the agile book but it''s not working. Here''s what I have: app/models/date_callbacks.rb class DateCallbacks def before_validation(model) if model.start_date > Date.today model.errors.add(:start_date, "must be before today") end if !model.end_date.nil? if model.end_date > Date.today model.errors.add(:end_date, "must be before today") end end if !model.end_date.nil? if model.end_date < model.start_date model.errors.add(:end_date, "must be later than start date") end end end end app/mode...
2006 Jun 25
3
Sorting results by column
I have the acts_as_ferret plugin installed. Everything searches great, but I would like to limit the results (i.e. by ''end_date'') and sort them (by ''end_date''). ''end_date'' is a valid column in my "posts" table. Here''s the code I have already: @posts = Post.find_by_contents(params[:query]) params[:query] comes from a form. I am replacing less efficent code...
2013 Jan 29
2
Count entries in postgresql grouped by date
...sited_at: attribute which is a datetime field. They seem to be stored as UTC. Now I want to count all visits each day and return something like: { 2013-01-01: 8, 2013-01-02: 4, 2013-01-07: 9, ... } So, I did it like this which kind of works...: def self.total_grouped_by_day(start_date, end_date) visits = where(visited_at: start_date..end_date) visits = visits.group("date(visited_at)") visits = visits.select("date(visited_at) as date, count(visits.id) as total_visits") visits = visits.order("date ASC") visits.group_by { |v| v.date.to_date...
2010 Jun 08
2
type conversion with apply or not
...ta frame consisting of a (large) number of date columns, which are read in from a csv file as character string. I want to convert them to Date type. Following is an example, where the first column is of integer type, while the rest are type character. > head(df) TRANSNO TRANS.START_DATE TRANS.END_DATE DIVISION FASB 1 250897 7/1/2010 7/31/2010 PSTRUCT Z 2 250617 8/1/2010 8/31/2010 PSTRUCT Z 3 250364 4/1/2011 6/30/2011 PLR Z 4 250176 4/1/2011 6/30/2011 PLR Z 5 250176 4/1/2011 6/30/2011 PLR Z 6 2...
2006 Jun 18
4
uninitialized constant Datetime
I am building an application and I have generated the scaffold for a product. In the list method I include something like my_date = Datetime.now and the result I get from the webrick is an error uninitialized constant Datetime Do I have to add a line with a require? I am new at ruby on rails thanks in advance -- Posted via http://www.ruby-forum.com/.
2006 Jun 25
1
Using AND in :conditions queries
...; <input type="submit" value="Search &#187;" class="primary" /> <%= end_form_tag %> and the controller: @posts = Post.find(:all, :conditions => [ ''title LIKE :search_query OR body LIKE :search_query AND end_date >= :now'', {:search_query => ''%'' + params[:query] + ''%'', :now => Time.now}], :order => ''end_date'') I did check the log and all the variables are being passed o...
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
2008 Jun 24
10
Question on passing arguments inside a view.
I''m running into an issue undefined local variable or method `directoryid'' for #<EditorialsController:0x23f1bf8> I have two Models on a legacy database and only one controller called editorials with two actions index and display. I''m trying to pass in a parameter from the results of my search and getting the above error. Example: two tables one is editorial the
2004 Nov 08
2
Matrix Indexing
...hus, for example, the file looks something like this -> 1/31/04 2.5 2/1/04 2.6 ... 4/12/04 3.5 Basically, I use the function inputframe = read.csv( ) which reads the csv file into the inputframe. My question is, how can I make a function that has, as inputs, start_date and end_date, so that the inputframe would not return all of these prices but only the ones during the period I input? For example, if I input 3/1/04 and 3/11/04, the inputframe only contains the prices for this period. Any help is appreciated!! Kim
2012 Jul 10
1
calculating the difference between days?
Hi List, I have one column of beginning dates and one column of ending dates, I want to find their difference. And I want to ignore the trailing zeros, basically everything after the first colon mark. Begin_date End_date 01JAN2000:00:00:00:000 02FEB2002:00:00:00:000 24MAR2012:00:00:00:000 18MAY2012:00:00:00:000 01OCT2003:00:00:00:000 02FEB2004:00:00:00:000 01JAN2000:00:00:00:000 02FEB2000:00:00:00:000 01JAN2000:00:00:00:000 02FEB2000:00:00:00:000 Thanks, Mike [[alternative HTML ve...
2008 Nov 11
1
Every other week recurring event
I have the code for computing a weekly event: (start_date..end_date).select{|d| d.wday == wday} but I am wondering if anyone has any ideas for using this to figure out a recurring event for every other week. Is it possible to somehow specify every other within the .select method? Any other implementation ideas? --~--~---------~--~----~------------~-------~--~--...
2013 Feb 26
4
3 models, joining and nested queries
...capacity: integer primary_key=''ref'' has_many :bookings, :class_name=>"Booking", :foreign_key=>''room_ref'' belongs_to :host Class Booking ref: string room_ref :string start_date: date end_date: string number_of_guests :integer primary_key=''ref'' belongs_to :room Here one should be able to see the vacancies against each host. A person when he enters the start date, end date and number of persons to book for a room, he must get the list of hosts...
2007 Jan 16
1
Can't pass parameters to Ziya controller using url_for
...ne parameter through to the action. <%= gen_chart( "overview_graph", url_for( :controller => ''graph'', :action => ''graph'', :graph_id => GraphController::GRAPH_OVERVIEW, :start_date => @report_params[:budget_period][:start_date].to_f, :end_date => @report_params[:budget_period][:end_date].to_f, :size => 300 ), "#ffffff", 300, 300 ) %> This just doesn''t work, however. The start date is passed through to the underlying action, but the rest of the parameters aren''t. The HTML generated by t...
2006 Dec 27
0
HABTM Checkboxes - Adding/Updating Users to a Project
...t.column "user_id", :integer, :default => 0, :null => false end create_table "projects", :force => true do |t| t.column "title", :string t.column "description", :text t.column "start_date", :datetime t.column "end_date", :datetime end create_table "users", :force => true do |t| t.column "first_name", :string t.column "last_name", :string end --------------------- MODELS --------------------- # Assignment class Assignment < ActiveRecord::Base belongs_to...