Displaying 20 results from an estimated 1000 matches similar to: "Timestamping in log file?"
2008 Apr 04
5
First call to worker method doesn''t work
I have a worker as follows:
class SampleWorker < BackgrounDRb::MetaWorker
set_worker_name :sample_worker
def create(args = nil)
# this method is called, when worker is loaded for the first time
end
def my_method
# Deliver test e-mail message
Notifications.deliver_message(1, "DM")
end
end
I have a rails controller that calls the following code:
worker =
2006 Dec 02
3
Scoping expectations and more ...
Hello!
I''m new to Mocha and through experimentation I found out something
that is not explicitly stated in the documentation: If you need to
mock the same function call with different parameters and results, you
can set the scope of expectations with a begin ... end block.
I also made up an example on how to expect more than one function call
with different parameters and return values.
2006 Feb 21
11
helper for models?
Is there such a thing?
I have some duplicate methods in my models, can I place them somewhere
and call them in to my models, thus keeping DRY?
--
Posted via http://www.ruby-forum.com/.
2013 Nov 29
1
How to catch warnings sent by arguments of s4 methods ?
Hello,
I apologized if this had already been addressed, and I also submitted
this problem on SO:
http://stackoverflow.com/questions/20268021/how-to-catch-warnings-sent-during-s4-method-selection
Example code:
setGeneric('my_method', function(x) standardGeneric('my_method') )
setMethod('my_method', 'ANY', function(x) invisible())
2005 Sep 27
2
No Custom Validation
Hi,
Correct me if I am wrong but there doesn''t seem to be an easy way to add
validation outside the pre-built ones (validates_presence_of,
validates_lenght_of, etc.).
Ideally there should be something like:
Class Person < ActiveRecord::Base
validates :my_method, :on => create, :message => ''was not valid''
def my_method(param)
false unless
2005 Dec 30
6
call a method once per page request
Hi,
I''m wondering if there is a simple solution to call a method once per
page request.
I tried to place my call in a before_filter in ApplicationController but
it''d called a second time if I use render_component from a view.
Seems to me that a hook should be added in Dispatcher#prepare_application.
Context: working on i18n, I''m trying to check lang either from uri,
2006 Jun 19
1
AJAX - Image output to an IMG tag ?
Hi,
I''m using the "link_to_remote" AJAX function call from my "view", and
what i want is after i get the results from the function call, I want to
update the result
directly into to an image ie. <IMG> tag, how to do this.??
ie. if we want to update the result into a ''div'' element we do like
this, which works fine..
link_to_remote(:update
2004 Mar 02
3
error() and C++ destructors
Hi,
I am writing C++ functions that are to be called via .Call() interface.
I'd been using error() (from R.h) to return to R if there is an error,
but then I realized that this might be not safe as supposedly error()
doesn't throw an exception and therefore some destructors do not get
called and some memory may leak. Here is a simple example
extern "C" void foo() {
string
2006 Jun 17
1
magic disappearing parameters
I have a method in application_helper.rb like this:
def my_method(arg1, arg2 = {})
...
end
when I call this method from an rhtml file like this:
my_method @var
I get this message:
wrong number of arguments (1 for 0)
When I call the method without arguments like this:
my_method
I get this message:
wrong number of arguments (0 for 1)
I am new to Ruby and Rails so I presume that
2006 Jun 21
2
access to application.rb methods
Why can''t I access the utility methods defined in applicaion.rb from the
model classes? If that does not work, where is the best place to put
common utility methods that must be available to all the models.
thanks
--
Posted via http://www.ruby-forum.com/.
2007 Jul 16
4
Set the return value to "same as block"
It would be good to be able to set the return value to be the same as
the return value of the block. I am trying to test opening a file in a
block and reading from it. It would be nice to use code like this:
object.stubs(:open).with("/path/to/file", "r").yields(
stub(:read => "The file contents")
).returns(from_block)
Which would make open() take the return
2006 Dec 06
10
Stem Analyzer
Hi all,
I am trying to implement a search that will use the Stem Analyzer. I
added the Stem Anaylzer from the examples shown in another post
http://ruby-forum.com/topic/80178#147014
module Ferret::Analysis
class StemmingAnalyzer
def token_stream(field, text)
StemFilter.new(StandardTokenizer.new(text))
end
end
end
The problem with the Stem analyzer is that when I search for a
2006 May 18
2
How to debug the rendering in Rails?
Hi,
I have some controller code like this:
def mailing_lists
@ml = MailingList.find_by_identifier(@params[:id])
@messages = @ml.messages
@headers["Content-Type"] = "application/atom+xml"
@response.headers[''Last-Modified''] =
@messages.last.created_on.httpdateunless @
messages.empty?
minTime =
2006 Sep 29
2
multiyield
I lied, I don''t actually need different responses each time I call
the method. So the last email of mine is probably worthless.
Instead, I need yield to yield 3 values when I call it once:
(behavior that mimics Find.find)
def test_generate(documentation = ''/test_documentation/'',
destination = ''/destination/'')
2006 Apr 14
8
Error with Web Service tests after upgrading to Rails 1.1.2
Hello.
I hope this is the right place to describe my problem ?
After upgrading to Rails version 1.1.2 from rails version 1.0.0, Web
Service functional tests seem broken.
I upgraded rails (as the root user / administrator) with:
# gem update rails --include-dependencies
then I upgraded my application (as myself) with:
? rake rails:update
% rake rails:update:configs
After these steps,
2017 Jun 29
2
Re: sieve/vacation: bad parsing of 'References' header
On Thursday, June 29, 2017 16:38 CEST, Christian Kivalo <ml+dovecot at valo.at> wrote:Stephan Bosch already mentioned in this thread that it's is a more
recent feature of doveconf to also report the version of pigeonhole.
I didn't know that this hadn't existed in dovecot v2.2.9.Yes sorry I saw his reply after I sent my email.
Any thoughts about this issue in the version 0.4.2?
I
2005 Jul 20
2
.spl files
I am not certain that this is the right place to post this, but maybe
some kind soul can point me in the right direction if not. And I
apologize if this is the wrong spot...The reason I posted here is that
I recall running across a syslinux changlog that said "..added support
for reading .spl..." files. I want to customize the suse boot up
splash screens (for a CD install). I have been
2007 Mar 21
4
How to spec error_messages_for
Hi
I''m trying to spec a call to error_messages_for to avoid stubbing out
whole models. Something like this:
context "A rendered calculate_quote view" do
setup do
@form = mock("form")
assigns[:form] = @form
end
specify "should render the error messages" do
<SOMETHING>.should_receive(:error_messages_for).with
2008 Feb 22
7
Testing misc methods in ApplicationController
I''m already successfully testing before_filters in application_controller
courtesy of this blog post:
http://www.movesonrails.com/articles/2008/01/23/spec-ing-your-application-controller
However, i can;''t work out how to test the sort of method that is added to
application_controller so that all controllers can use it. It must be
something simple that i''m doing
2015 Sep 01
2
Has the changelog for R-devel and R-patched moved?
On Tue, Sep 1, 2015 at 10:57 AM, peter dalgaard <pdalgd at gmail.com> wrote:
>
> On 01 Sep 2015, at 16:21 , Avraham Adler <avraham.adler at gmail.com> wrote:
>
>> Hello.
>>
>> There used to be changelog of sorts for R-devel [1] and R-release [2].
>> Neither have been updated since 2015-07-24. Have these moved
>> elsewhere, or are they no longer