Displaying 20 results from an estimated 120 matches similar to: "add one month or one year to a date"
2006 Jul 27
2
Creating multiple objects from form data
I''m in the process of creating a sign up form for an online application.
The form collects account info, company info, and then info for an
administrative user.
The method looks like this:
def create
@account = Account.create!(params[:account])
@company = @account.companies.create!(params[:company])
@user = @company.users.create!(params[:user])
end
However, this inevitably fails
2009 Apr 07
4
/lib daemon folder: how do i add a module into the daemon?
I am using the daemons plugin.
I have just one problem how do i add modules from the /lib folder to
the /lib/daemons/daemon.rb file
eg. /lib/basic_functions.rb
this is the file i want to load in daemon.rb
contents daemon.rb:
#!/usr/bin/env ruby
# You might want to change this
ENV["RAILS_ENV"] ||= "production"
require File.dirname(__FILE__) +
2006 Oct 24
1
Code blocks syntax as method arguments
How do I format this so that it does what I want it to,
Day.find_by_month_and_year(
[Date::today.month + 1 if !Date::today.month == 12 else 1 end],
[Date::today.year if !Date::today.month == 12 else Date::today.year +
1 end]
)
?
WHICH IS
to pass Day.find_by_month_and_year Date:today.month +1 if the month is
not december otherwise pass, 1, and to pass as the second argument
2007 Dec 12
6
Add a month to a Date object
Howdy all,
This may be the dumbest question in the world, but how can you "add
one month" to a Date object? I can''t just add 30 days, because months
have varying lengths.
Any help would be much appreciated...
Thanks!
-Neal
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2006 Jul 31
2
ambiguous column name in has_many :through
In my application model I have three classes: Accounts, Projects, and Items
class Accounts < ActiveRecord::Base
has_many :items, :through => :projects, :source => :items
has_many :late_items, :class_name => ''Item'', :through => :projects,
:conditions => [''due_on < ?'', Time.now], :source => :items
end
class Projects <
2011 Nov 17
1
how to read a free text file into individual variables
hi ,I am writing a soft package based on R.
But when I try to read a configure file showed as below.
How can I read the parameter in this text file.
How can I read the parameter into each variable in this file ?
configinfo<-scan(file(configfile),ok=TRUE,n=-1)
scan seems need every line have same column ?
configinfo <- readLines(configfile,ok=TRUE,n=-1)
methodnum <-
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 <
2006 Jul 18
2
date conversion
how to convert a "%d/%m/%Y" date to a "%Y/%m/%d" date?
2005 Oct 11
6
adding 1 month to a date
Within an R dataset, I have a date field called “date_”. (The dates are in the format “YYYY-MM-DD”, e.g. “1995-12-01”.)
How can I add or subtract “1 month” from this date, to get “1996-01-01” or “ “1995-11-01”.
---------------------------------
[[alternative HTML version deleted]]
2010 Nov 05
3
non event_calendar
What am I missing here, trying to get the event_calendar plugin working
with my existing app. Have installed the plugin, which I guess is a good
start, then this...
class Booking < ActiveRecord::Base
has_event_calendar :start_at_field => ''arrival_date'', :end_at_field =>
''departure_date''
Route...
map.availability_calendar
2006 Jun 30
3
passing parameters to functions
I''m new with ROR and am confused about passing parameters to functions.
I have a controller called Schedules and that calles a calendar helper
for a view called show_cal.rhtml. I need to be able to pass in a
specified month and year to get the correct schedule calendar to display
in the view. I''m just starting with this and am simply trying to
display the parameters
2002 May 03
2
merge (PR#1510)
Full_Name: Martin Elff
Version: 1.5.0
OS: MS Windows 98
Submission from: (NULL) (134.155.91.46)
Merging of two data frames by variables with different names
(using by.x and by.y) is no
longer possible (it was possible in version 1.4.1).
Call:
mvoteint.classd.matadd <- merge(
unique(mvoteint.classd),
unique(subset(dimens.mpp,
2011 Oct 22
1
Help w/an old R program I've rediscovered and want to make work
I found an old R program I wrote som eyears back and I'd like to make work in
2.11.1 (or a more recent version), but am having two problems:
1. I can't seem to access the datafile it requires. I'm not sure where the
default place that R looks to for files references within it is, or what
exactly the format is for pulling in the data, by my own #comments from a
few years ago
2006 Jul 28
6
need recommendations for apache configurations
I''m running a rails app on FedoraCore4 and so far have been using
lighttpd and fastcgi. I''ve decided to switch to apache because lighttpd
has been far too unstable, unpredictable, and slow. I don''t know if it''s
lighttpd or the combination of lighttpd and fastcgi but it''s just not
working for me. I need something that has been proven to work and
2006 Jul 27
1
Oracle 9i R2 RAC with OCFS2
An HTML attachment was scrubbed...
URL: http://oss.oracle.com/pipermail/ocfs2-users/attachments/20060727/7421d1b9/attachment.html
2006 Jul 28
5
Best practice for sharing code between rails apps.
Is there a writeup about how to structrure your rails applications so
that you can share models, gems, libraries, helpers, and controllers
between them. It would be especially helpful if the discussion
involved how to structure your codebase in version control and how to
manage deployement.
2006 Jul 28
3
render :update working incorrectly
I have the following code
render :update do |page|
page.alert(''Hey there'')
end
Why is it taking me to a blank page with the following text at the top:
alert("Hey there");
This text is in <pre> tags as well. Its kinda weird. Thats what I want
to execute on the page that it came from. Any ideas?
This happens with the other commands where it renders the
2006 Jul 28
5
DREAMHOST SO SLOW
Does anyone know of any fixes to this?
Any industry-known tips/tricks?
The page loads sometimes take 20-30 seconds.
so bad.
mk
--
Posted via http://www.ruby-forum.com/.
2006 Jul 27
7
Newbie question---
I wrote a ruby script that parses a file into key-values like so:
class Parser
table = { }
IO.foreach(''Localizable.strings'') { |line|
if line =~ /^ \s* " (.*?) " \s* = \s* " (.*?) "/x
table[ $1 ] = $2
end
}
end
I want to store the key-values in different colums on my database so
that when I enter a key, it gives me the corresponding value...how
2006 Jul 27
7
cannot get past "Booting WEBrick"
Hi Everyone,
I am following the ''Agile Web Dev. with Rails'' book, and I used instant
rails to do the install on a Windows machine. Everything seemed to work
fine until I got to:
Booting WEBrick...
After that, nothing happens. I tried creating a new rails application, but
I get the same
problem. I also tried reinstalling to no avail.
Any ideas?
Thanks for the help.