Displaying 20 results from an estimated 1000 matches similar to: "Unit Testing Problem"
2009 Apr 07
3
assert_valid in unit tests after upgrade to rails 2.3 doesn't work
def test_valid
assert_valid State.first
end
Error:
test_valid(StateTest):
NoMethodError: undefined method `assert_valid'' for #<StateTest:
0x7f0d60750318>
I see that test_valid is now in
ActionController::Assertions::ModelAssertions. Does this mean that
test_valid is designed to be used i ActionController tests only?
I can change my assert_valid(State.first) into assert
2011 Apr 18
1
has a field through an association
Hey guys,
Trying to figure out how to do something like the following:
class Child
belongs_to :parent
has_field :some_field, :through => :parent
end
class Parent
has_one :child
attr_accessible :some_field
end
child.some_field #=> parent.some_field
child.some_field = value #=> sets parent.some_field = value
I can of course accomplish this by adding custom accessors
2008 Apr 02
9
Problem getting the most recent has_many associated object
I can''t get my view to display the most recent parameters from an
associated object in a view... here is a birds-eye of my app:
I have two models, Ferms and Kinetics. Ferm has_many :kinetics,
Kinetic belongs_to :ferm. Kinetic has the fields ferm_id, brix and
temp.
In my ferms/index view I have a table listing the attributes of each
ferm instance. I would like to display the most recent
2011 Feb 27
1
Database abstraction
Hi all -
I've been working on a lite ORM and database abstraction package for R.
Formatting complex queries by hand has always been an error-prone hassle, so
I've tried to do away with that as much as possible, instead, using R
objects to represent elements of a database system (statements, clauses,
operators, functions, fields, tables, etc.). R5 classes have made the
development of this
2007 May 06
1
validates_uniqueness_of (with :scope) doesn't seem to work?
I have a master record called ''project'' and a child record called
''agycode''. Obviously, agycode has a project_id FK. I wish to make the
"descr" field unique ONLY within the ''project_id'' ''scope''. Here are the key
pieces of information
Agycode fields (id, project_id, descr)
Here''s the declaration in the
2006 Sep 29
7
help needed in UNIT Testing
hi guys,
I needed help in Unit test. i just try to save new data intomy test
database.
but save method does not works for me. the result shows here
def test_new_avail
avail = Avail.new(:vendor_id => 1,
:last_mod_by => ''Murali'',
:updated_at => ''2006-08-17 13:14:59)
assert avail.valid?
assert avail.save
end
2008 Aug 27
5
VALIDATION QUESTION
I''m trying to validate a record before save. I''m using one controller
in this case furnii where I have all my calls. The problem is that, the
form containing the field I''m trying to validate resides in the furnii
views. I tried to add validates_presence_of :content (the field name) in
both the furnii model and the ratecomment model but it does not work. I
know there
2006 Jul 26
1
Polymorphic Associations: dynamic finders
Is there any sort of dynamic finder for polymorphic associations?
For example if I had:
class InviteNode < ActiveRecord::Base
belongs_to :inviteable, :polymorphic => true
end
I would like to be able to search by:
InviteNode.find_by_inviteable(some_object)
instead of having to do:
InviteNode.find_by_inviteable_id_and_inviteable_type(some_object.id,
some_object.class.name)
obviously I
2015 Jan 27
7
[LLVMdev] IR extension proposal: bitset constants
Hi all,
I would like to propose a mechanism that allows IR modules to co-operatively
build a pointer set corresponding to addresses within a given set of
globals. The specific use case I have in mind is to provide a mechanism
for a C++ program to efficiently verify (at each call site) that a vtable
pointer is in the set of valid vtable pointers for the class or its derived
classes. One way of
2006 Feb 15
11
VPS hosting
Speaking of hosting, have any of you used a VPS provider that offers
gentoo as the VPS OS? All of the ones I know of use fedora, debian,
ubuntu, or CentOS.
--
- Adam
** Expert Technical Project and Business Management
**** System Performance Analysis and Architecture
****** [ http://www.everylastounce.com ]
[ http://www.aquick.org/blog ] ............ Blog
[
2010 May 27
4
[PATCH] Rails 3: fields_for helper doesn't work with association proxy objects
Request for eyeballs. :-)
Mongoid uses association proxy objects. It overrides #nil? => false
when the association is missing. However since it uses proxy
objects, !!assocation is always true.
I have created a ticket with a patch that changes the association nil
test to call assocation.nil? rather than use implicit coercion of the
variable.
See:
2015 Jan 28
3
[LLVMdev] IR extension proposal: bitset constants
I would start from using module-level metadata.
An IR extension might be a good idea once we show that
- the proposed indirect call protection mechanism is efficient and
useful, and
- there are other use cases for the IR extension.
--kcc
On Wed, Jan 28, 2015 at 2:57 AM, Sean Silva <chisophugis at gmail.com> wrote:
> Is there any way to accomplish this that doesn't require
2006 Mar 06
46
Capistrano 1.1
Capistrano is a utility for executing tasks in parallel across
multiple remote hosts. It was formerly known as SwitchTower.
Installation:
gem install capistrano
Manual:
http://manuals.rubyonrails.org/read/book/17
Version 1.1 introduces a few changes:
* Renamed! Due to the trademark infringement debacle of last week, we
had to change the name. Moving forward it will be known as
2007 Mar 13
13
validates_inclusion_of disabling
Hello all.
I have a problem using validates_inclusion_of. I need to switch off some
validations during a migration period, is there a way?
I tried to use if, with a static method of one of my models, but the
behaviour is something strange
It seems that the static method should be in a string to be evaluated.
And the order of the elements in the if is counting...
:if => (:some_field
2015 Jan 29
3
[LLVMdev] IR extension proposal: bitset constants
So, bitset would be a property that means : globals with the same name will
append on a string of bits in the order in which they appear, and it's the
job of the front end to make sure the correct order is followed in every
unit, so that linking does the right job in every corner case?
Could that be used for efficient global boolean flags, like LLVM's options?
Even if you don't need
2011 Aug 03
1
Gem and/or meta_where problem
I''ve installed the gem "meta_where" (and it reported back:
"Succeeded") but when I use the example in a search method of a
controller:
Person.where(:some_field.matches => ''%something%'')
there is an error that it doesn''t know the method ''matches'', so what
still needs to be done to properly activate the gem and make its
2006 Mar 09
22
How to scale mysql servers for a rails application?
I''m a developer working on an application that will potentially be
used by around 500,000 users on a daily basis. Plus some internal apps
communicating to it via ActionWebServices with a potentially high
demand.
Our Operations team is helping us define the necessary system
architecture, and I have one remaining question:
What is the best way to scale the database? I have no expertise in
2006 Mar 11
5
rails log
i know rails log is very good, detailed.
but find useful infos from big log is terrible.
any one have good idea.
regards
--
Posted via http://www.ruby-forum.com/.
2006 Feb 12
4
[newbie] if expression "weirdness"
Ok first i am running linux with lighttpd and apache proxy''ing to the
lighttpd process.
ruby version is
ruby 1.8.4 (2005-12-24) [i686-linux]
def test
@count = Question.count
if(@params[:id]) then
breakpoint()
if (params[:id].to_i > @count) then
redirect_to :action => ''finish''
end
end
end
this is a stripped down version of
2006 Feb 10
4
Handling a relationship between users and newsletter subcriptions.
Hey Everyone!
I have a newsletter system that contains a multitude of different
newsletters. In this case three but the system allows the user to
add more. Every user can be subscribed to any amount of given
newsletters. So what I did was I created a user model, newsletter
model, and subscription model.
The subscription model belongs to one user and one newsletter.
However,