Displaying 20 results from an estimated 3000 matches similar to: "[PLUGIN] instance_validations"
2007 Mar 13
1
Opening the singleton class of mocked objects
I wrote a plugin [1] a while ago that lets me do validations on a
single AR instance. Instead of defining validations in an AR class, I
can define them on a AR instance''s singleton class:
class << @video
validates_presence_of :title
end
One of my specs mocks Video.find, and the above code is run on the
mock object. When I run the spec, I get the expected
undefined method
2008 Jan 21
3
Story runner "macros"
I''ve gotten quite a bit out of Pat Maddox''s screencast
http://evang.eli.st/blog/2007/10/8/story-runner-top-to-bottom-screencast
One thing I''m not sure of is the feature where he writes things like:
When "I POST to", "/articles", :post => {:title => "Title", :body
=> "Body") do | path, params|
post_via_redirect
2007 Apr 04
2
[PLUGIN] ArPaginator - Allows you to easily paginate over any existing AR queries.
The built-in Rails pagination is fairly limited...you pass in the
model name, and optionally some conditions, and it generates a
paginated query for you. This gets to be very bad if you''ve got any
custom queries.
class Company < ActiveRecord::Base
def complete_videos
Video.find :all, :conditions => "company_id=#{id} AND
status=''complete''", :order
2007 Jan 19
3
Something cool I learned about rspec today
I found an awesome feature today. When you''re setting expectations,
you can actually pattern match the parameters to methods. Here''s my
discussion and example:
http://evang.eli.st/blog/2007/1/19/parameter-matching-in-rspec
Pat
2005 Mar 15
2
Asterisk Queue strange behaviour
Hi.
I have a problem which I assume would be easy to fix, but I can't find
anything about it...
I wish to have people dialing my phone, and if it is busy, they are put
into a queue. And then I am dialed back when the previous call is
finished, and connected to the waiting caller.
Easy enough?
----------exten
exten => 6,1,Background(salesq-intro);
exten => 6,2,Queue(salesq|tT|||300);
2008 Jun 24
4
1.0.14 -> 1.1.1: dovecot-uidlist errors
I've just updated from 1.0.14 to 1.1.1 (Maildirs). According to
<URL:http://wiki.dovecot.org/Upgrading/1.1>, "dovecot-uidlist file is in
a new format. The old format is automatically converted to new one."
When I try to delete a message (which moves it to the IMAP Trash
folder), I get the following looping sequence of errors until I cancel
the delete operation in the mail
2007 Feb 03
2
Boost Sorting with Acts_as_ferret?
Hey guys,
Simple question here.
I have a single index of recipes, from which I''m looking at the
following fields: Name, Ingredient Text, Tags, and Description.
The key is, I want to show all the results that come from Name,
before I show any of the results from Ingredient Text, Tags, or
Description.
I tried doing this:
acts_as_ferret :fields => {
:name =>
2007 Sep 03
6
blog post on story runner
Here''s an excellent blog post on Story Runner, which will be part of
the next release and is undergoing active development in trunk:
http://evang.eli.st/blog/2007/9/1/user-stories-with-rspec-s-story-runner
2017 Nov 01
1
Creating Tag
i want to tag categories to its menuname.
i have a csv containing menu item name and in other csv i have a column
containing some strings,
i want to pick that strings from categories and look into menu items if
any menu item containing that string i want to create a new column next to
menu item name flagged as 1 otherwise 0
and the only condition is once a menu item flagged as 1 i don't need
2007 Apr 04
1
[PLUGIN] count_from_query - easily convert finder queries into count queries
count_from_query gives you the ability to generate a COUNT query from
a standard Rails find.
For example, if you have the query
User.find :all
it would be trivial to get a count:
User.count
however, if you have a more specific finder method, such as
class Company < ActiveRecord::Base
def complete_videos
Video.find :all, :conditions => "company_id=#{id} AND
2007 May 18
0
Fwd: <$$$> FRIED CHICKEN RECIPES <$$$>
[image: Fried Chicken Recipes]
<http://freefoods.50webs.com/fried_chicken_recipes/>
*if you need Fried Chicken** Recipes please visit this site* *
http://freefoods.50webs.com/fried_chicken_recipes/** * If you need any
information about *Fried Chicken* * Recipes* please reply me.
*Thanks *
*ANJLI
*
--~--~---------~--~----~------------~-------~--~----~
You received this message because
2006 Nov 14
3
messed-up habtm relationship
Hi,
I have a many-to-many relationship between dishes and ingredients
class Dish < ActiveRecord::Base
has_and_belongs_to_many :ingredients
end
class Ingredient < ActiveRecord::Base
has_and_belongs_to_many :dishes
end
I have a join table dishes_ingredients
now when i access my_dish.ingredients, i get a list of what looks like
Ingredient objects, but the but they don''t have
2007 Apr 04
0
rspec_plugin generator
I''ve created a couple plugins lately, and have been using RSpec
instead of Test::Unit for them, so I wrote up this little generator.
Also does some isolated database testing if you want as an added
bonus. Basic info:
Rails gives us a generator to create plugins with ./script/generate
plugin. It creates all the stub files, including some tests for you.
What if you want to use RSpec
2003 Oct 15
2
problem getting mail from mbox
I'm trying to set up dovecot and I'm running into a few problems.
I just want to use IMAP for one user, everyone else gets POP3 from the
existing (working server).
$MAIL is set to /var/spool/mail/gavin_imap
In my /var/spool/mail directory I now have a problem:
-rw------- 1 gavin_im mail 1392 Oct 14 22:28 gavin_imap
-rw------- 1 gavin_im popusers 0 Oct 14 21:54
2009 Nov 12
0
Problem with has_many :through, :uniq => true with polymorph
Didn''t have quite enough space to describe it there...basically i''m
having a problem with the :uniq option in my tags.
I''m using acts_as_taggable_on_steroid which adds these associations to
my Resource class:
Resource
has_many :taggings, :as => :taggable, :dependent => :destroy, :include
=> :tag
has_many :tags, :through => :taggings, :uniq => true
2008 Oct 03
2
suggestions for plotting 5000 data points
Dear all,
I have a collection of 5000 entries which represent the evolutionary
rates of 3 animals.
I would like to show the differences between the rates of all 3
animals and have tried using the function parallel (from the lattice
package) and pairs() function.
The parallel function would have been perfect save for the large
number of data (5000). The pairs() function doesn't show
2006 Sep 12
1
Re: Yum update to 4.4 stamps all over rndc.conf
Email Lists wrote:
> -> Once the number three, being the third number, be
> -> reached, then lobbest thou thy Holy Chicken of Antioch towards thy
> foe,
>
> Ok... after much chasing around the yard and far too much clucking
> baaaagokkkkk racket... I have the chicken!!!
>
> Still alive I might add. :-)
>
> Now, where in scripture do I find this again? :-)
2010 Oct 06
0
Error customization problem.
Hi,
I have following models
class User < ActiveRecord::Base
has_many :addresses, :as =>:addressee, :dependent => :destroy
accepts_nested_attributes_for :addresses, :allow_destroy => true
end
class Address < ActiveRecord::Base
belongs_to :addressee, :polymorphic => true
validates_presence_of :address1, :maximum => 50,:message => "Address1
cannot be
2005 Feb 19
0
[Error] Using validates_presence_of for datetime field causes parse error?
Hi Everyone -
I''ve got an odd sort of error when I try to use validates_presence_of
for a MySQL ''datetime'' field. Here''s the relevant portion of the table
definition:
mysql> describe student_surveys;
+---------------------+---------------------+------+-----
+---------------------+----------------+
| Field | Type | Null |
2012 Mar 14
1
check for data in a data.frame and return correspondent number
Dear R-ers,
still the newbie. With a question about coordinates of a vector appearing or
not in a data.frame.
I have a data.frame (MyData) with 3 columns which looks like this:
V1 V4 redNew
red-j 10.5032 appearance blood-n
red-j 9.3749 appearance ground-n
red-j 10.2167