Displaying 20 results from an estimated 50000 matches similar to: "Date class giving me errors"
2006 Jun 23
0
Date class giving errors
Any time I try to use any methods of the Date class, I get errors of
''invalid date''. For example, I have this happening:
With the code Date.today, I get this error from Rails:
- - - - - - - - - -
ArgumentError in Student#show
Showing app/views/student/show.rhtml where line #10 raised:
invalid date
Extracted source (around line #10):
7: <p> <%=
2006 Jul 20
2
Carrying model date from one page to the next
I am working on a crude first-go-round-in-rails shopping cart and
can''t figure out for the life of me the best way to do this. I have a
shopping cart that has one page during the checkout that handles the
address information, then the next handles the actual credit card
information. How do I take the information from the address form and
keep it alive long enough to put it in to
2006 May 18
1
multi_search problem
I am running into the following error when I try to search across
multiple models with multi_search() I have rebuilt the indices and can
search on each model individually using the Rails console.
Here is the output from the console.
>> Post.multi_search(''new'', [Message, WikiPage])
ArgumentError: wrong number of arguments (1 for 0)
from
2006 May 16
10
Date verus Time class
I''m using the date_select and datetime_select helpers in my view, and
they return Date classes from the params hash.
But how do I work with Date classes, they don''t print human readable
dates or times, Time classes work well I can use strftime("%H:%M") to
print to the screen.
Is it possible to convert a Date to a Time, Ive been tinkering in irb
but have got
2007 Sep 25
2
Bug in win32-api with void prototypes?
Hi all,
It seems that a void prototype requires an explicit argument in our
version of win32/api:
C:\>irb
irb(main):001:0> require ''win32/api''
=> true
irb(main):002:0> include Win32
=> Object
irb(main):003:0> require ''Win32API''
=> true
# Our version
irb(main):004:0> GetLastErrorA = API.new(''GetLastError'',
2012 Jul 26
2
ruby bindings, ruby 1.9.3 and xapian
Hello,
I've problem with xapian or sth.
Ubuntu 8.04, ruby 1.9.3 with rvm, when Im trying to initialize
database, Im getting this error:
irb > require 'xapian'
==> true
irb > database = Xapian::WritableDatabase.new('/full_path/db/xapian_db/development', Xapian::DB_CREATE_OR_OPEN)
ArgumentError: Wrong arguments for overloaded method
2006 May 20
1
acts_as_paranoid overrides ActiveRecord::Base??
Guys,
I am trying to figure out what exactly does this line do at the end of
"acts_as_paranoid" plugin?
ActiveRecord::Base.send :include, Caboose::Acts::Paranoid::ActiveRecord
My problem: I have some classes that I use acts_as_paranoid, and others
with tagging support. Classes declared as taggable, throw error, which
appears to be in the acts_as_paranoid version of the
2006 Dec 22
2
Relating Namespaced Models
I am dealing with a large project. I use a lot of STI and therfore have
a lot of models. I''d like to use namespaces to help organize my models
but am having trouble getting started.
I have a base model Term::Base located in /app/models/term/base.rb:
class Term::Base < ActiveRecord::Base
set_table_name "terms"
end
I have a non-namespaced client model:
class Client <
2008 Oct 30
2
Rails console
I tried to create an addition to Enumerable called choose_randomly
that picks a random element from the Enumerable object. However when I
define it and execute the code rand complains about the wrong number
of arguments. Below is a capture of the ./script/console session.
farrel@nicodemus ~/Work/GreenGreen/Code/green_green_client_application
$ ./script/console
Loading development environment
2008 Sep 12
1
ArgumentError: Unknown key(s): dependant
Hello,
I came across an association error today with facebooker.
class Cover < ActiveRecord::Base
belongs_to :album
end
class Album < ActiveRecord::Base
has_one :cover, :dependent => :destroy
end
At the console:
>> Album.find :first
ArgumentError: Unknown key(s): dependant
from
2012 Jul 05
1
hash to_yaml in erb template not giving valid yaml
Hi,
I want to use a file resource to write a facts.yaml file for
Mcollective. For some reason it won''t provide a valid yaml format if I
dump my scope to hash and convert to_yaml.
file {
"/etc/mcollective/facts.yaml" :
owner => root,
group => root,
mode => 400,
loglevel => debug,
#content => inline_template("<%= scope.to_hash.reject {
2007 Nov 29
4
collection.build or collection.create gives "ArgumentError: wrong number of arguments (1 for 0)"
I have a Project that has_many Tasks. Tasks belongs to a Project. When
I try the following:
project = Project.new
project.tasks.build
I get:
>> s = Project.new
=> #<Project:0x25f9e28 @attributes={"name"=>"", "end_at"=>nil,
"updated_at"=>nil, "published_at"=>nil, "user_id"=>nil,
2009 Feb 21
2
ArgumentError on model create statement
I have a rails app model that I''m getting a strange error that is just
baffling me. I''ve stripped everything out of my model down to the
basics and still get the error.
So, here is the current model:
class Metric < ActiveRecord::Base
end
When I go into the console, and issue a simple "Metric.create" command I
get the following error:
>> Metric.create
2007 Oct 04
0
Prototyping the Dir class
Hi all,
I''ve been prototyping a Windows-only Dir class for Ruby. Below is what
I''ve got so far. The class methods were easy, except for Dir.glob. The
code in dir.c is just nasty, and I can''t help but think that it could be
heavily refactored. I did come across this link:
http://www.codeproject.com/file/fileglob.asp
But I haven''t investigated it yet. Anyone
2011 Jul 04
2
when use mongoid , Model.count can't work.
Hi, when i use mongoid to get the count of model named "User", I met a
error :
irb(main):001:0> User.count
ArgumentError: wrong number of arguments (1 for 0)
from /var/lib/gems/1.8/gems/mongoid-2.0.2/lib/mongoid/
cursor.rb:37:in `count''
from /var/lib/gems/1.8/gems/mongoid-2.0.2/lib/mongoid/
cursor.rb:37:in `send''
from
2008 Apr 15
1
acts_as_paranoid Unknown key(s): with_deleted
Trying this straight from the README:
I have acts_as_paranoid in my model (Course), and added the deleted_at
column.
This is OK:
Course.find_with_deleted(:all)
Course.find(:all, :with_deleted => true)
gives:
ArgumentError: Unknown key(s): with_deleted
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/
active_support/core_ext/hash/keys.rb:49:in `assert_valid_keys''
2009 Sep 25
0
WWW::Mechanize and Rails console not playing well
I can run this code just fine in irb, but when I run it in rails
script/console, I get an error:
>> res = agent.submit(search_form, search_form.buttons.first)
ArgumentError: one hash required
from /home/jwoods/NetBeansProjects/activista/vendor/rails/
actionmailer/lib/../../actionpack/lib/../../activesupport/lib/
active_support/core_ext/string/interpolation.rb:85:in `%''
2012 Sep 12
8
Round off method in 1.8.7
Hi all
i am trying to use round method if have a value 2.08 i want it as 2.1 and
it worked in 1.9.2 but not in 1.8.7 is there any other way of doing it.
USING 1.9.2
1.9.2p320 :001 > 2.08.round(1)
=> 2.1
1.9.2p320 :002 > 2.04.round(1)
=> 2.0
USING 1.8.7
irb(main):001:0> 2.08.round
=> 2
irb(main):002:0> 2.08.round(1)
ArgumentError: wrong number of arguments (1 for
2008 Jun 05
2
xhr :post giving wrong number of arguments on rails 2.1?
Getting a strange error.
In a story I have the following step:
When "I submit a search name" do
xhr :post, ''/searches'', {:search => {:given_name => "bob", :family_name =>
"smith"}}
end
I am getting:
ArgumentError: wrong number of arguments (4 for 3)
stories/searching_story_spec.rb:45 in "I submit a search name"
But I only
2006 Mar 28
11
ActionWebService date casting error
I have defined a web service to return information from a database as follows.
class BackendApi < ActionWebService::API::Base
api_method :find_all_vobs,
:returns => [[:int]]
api_method :find_vob_by_id,
:expects => [:int],
:returns => [Vob]
class BackendController < ApplicationController
wsdl_service_name ''Backend''