Displaying 20 results from an estimated 1000 matches similar to: "plotting several yearly/monthly time series on the same plotting several yearly/monthly time series on the same graph"
2006 Jun 15
1
callback object problem
I''m trying to create a separate class to do validation so that about 10
models can use the same date validation. I have tried to use 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
2007 Jan 16
1
Can't pass parameters to Ziya controller using url_for
Hi All,
I''m stuck yet again. I have an action on a controller that produces a
Ziya graph, which I call using the gen_chart() helper. However, I can''t
seem to pass more than one parameter through to the action.
<%= gen_chart( "overview_graph",
url_for( :controller => ''graph'', :action => ''graph'', :graph_id =>
2006 Dec 27
0
HABTM Checkboxes - Adding/Updating Users to a Project
Hello all,
I''m trying to create a HABTM checkbox action that adds/updates ''users''
to a ''project''.
I have the following laid out.
---------------------
TABLES
---------------------
create_table "assignments", :id => false, :force => true do |t|
t.column "project_id", :integer, :default => 0, :null => false
2007 Jul 08
2
datetime_select, is creating an instance of the Time class
Hello
It seems that datetime_select, is creating an instance of the Time
class. Why would that be?
I found this while building a site where people can create vigils
(prayer vigils, peace vigils, etc). When I added a validation method
that compared start_date to created_at, it generated the error:
ArgumentError (comparison of Time with DateTime failed):
I was able to put a breakpoint in the
2006 Mar 13
0
Pagination attributes
I have created a pagination with my own conditions :
@timesheets_pages = Paginator.new self, count, 30, @params[''page'']
@timesheets = Timesheet.find :all,:include
=>{:employee=>[:location,:division]},
:conditions => ["employees.location=?
and employees.division=? and start_date>? and end_date < ?
2010 Jun 08
2
type conversion with apply or not
Folks, i thought it should be straightforward but after a few hours poking around, I decided it's best to post my question on this list.
I have a data 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
2006 Jul 17
1
How to DRY up validates_presence_of
Given the case of validating the presence of an attribute and then
performing other tests on said attribute, how do you go about not having
to check for nil in the other tests?
Example:
validates_presence_of :start_date, :end_date
validate :validate_start_date_before_end_date
def validate_start_date_before_end_date
# without this check an exception will be thrown on access to the
2006 Feb 04
0
date_select
Can you see an obvious reason why this date_select code is failing?
The parameters from the form -
*Parameters*: {"commit"=>"Save All Changes", "campaign_id"=>"1",
"campaign"=>{"name"=>"fdsfas", "end_date(3i)"=>"26",
"start_date(1i)"=>"2006",
2013 Jan 29
2
Count entries in postgresql grouped by date
Hi!
I have a table with visits with a visited_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:
2009 Sep 19
0
Merging API data and ActiveRecord data for display in the view...
Hi there,
I’m trying to merge JSON results from an API call in with ActiveRecord
results for a blended display in a view. I’d like to be able to merge
the two result sets based on ''created_at'' which is is common in both
the ActiveRecord results and the JSON results from the API. Created_at
is the only common element between the two data sets.
Here’s what I have in my controller
2013 Feb 26
4
3 models, joining and nested queries
I have 3 models,
class Host
ref: string
address: string,
name: string
primary_key=''ref''
has_many :rooms, :class_name=>"Room", :foreign_key=>''host_ref''
Class Room
ref :string
host_ref: string
capacity: integer
primary_key=''ref''
has_many
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?
--~--~---------~--~----~------------~-------~--~----~
You received this message
2004 Nov 08
2
Matrix Indexing
Hi,
I have the following problem.
In a csv file I have under column A, the date, and column B, the prices.
Thus, 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,
2008 Jan 16
4
How to test if one range of dates overlaps another?
Hi all,
I have a situation with a recurring billing application where I need
to test if one range of dates "overlaps" another range of dates. Does
anyone know a rails find or mysql select statement that will test for
this? Here are the details:
* Recurringcharge items have a start_date and an end_date that
represent the period of time that the charges should occur.
* Statement items
2013 Mar 25
1
validates presence of foreign key fails in nested form
I''m using accepts_nested_attributes as follows:
class Timesheet < ActiveRecord::Base
attr_accessible :status, :user_id, :start_date, :end_date,
:activities_attributes
has_many :activities, dependent: :destroy
has_many :time_entries, through: :activities
accepts_nested_attributes_for :activities, allow_destroy: true
end
class Activity < ActiveRecord::Base
attr_accessible
2006 Feb 24
2
Model Inheritance?
Hello,
I need some help with designing a model I have in mind. I''m not sure
what the best way to do it in Ruby/Rails is, or even if what I''m
thinking is possible.
Basically, I have a system where I want to treat everything as a
"message." A Message is a basic model object with a title and
message_text. It can stand on it''s own, or it can be
2013 Mar 29
1
Create values based on a table of conditions
Hi R help forum,
I have a simple data frame of four columns - one of numbers (really a
categorical variable), one of dates and one
of data. I have over 500,000 data points to work with, spread over 40
files, each named after a different animal.
These are contact data recorded by proximity loggers over two years
between the animals of the file name and
collars being worn by other animals. The
2013 Mar 15
1
Reassign values based on multiple conditions
Hi all,
I have a simple data frame of three columns - one of numbers (really a
categorical variable), one of dates and one of data.
Imagine:
collar date data
1 01/01/2013 x
2 02/01/2013 y
3 04/01/2013 z
4 04/01/2013 a
5 07/01/2013 b
The 'collar' is a GPS collar that's been worn by an animal for a certain
amount of time, and then may have been worn by a different animal after
2006 Feb 07
0
complicated search/model question
Hi,
I have the models and db below and am putting together a scheduling application.
With what is laid out below (or any suggested changes) how would I find a
contractor for a job based on the contractor being available on a specific
weekday, at a specific time and not currently booked in to a job during the
same time?
I?m new to Ruby and Rails and making pretty good progress but I must admit I
2005 Dec 30
2
before_create question
I have the following models: User, Registration, Event.
User has_many Registration, Event has_many Registration, and
Registration belongs_to User and Registration. So far, so good.
There''s a registration deadline on a Event though, a few days before
the Event occurs.
So, I have this:
class Registration < AR
def before_create
errors.add_to_base("Registration deadline has