Displaying 20 results from an estimated 290 matches similar to: "Weird gsub behaviour"
2007 Nov 29
3
Strange Array behaviour
I''m having a strange thing when using the Enumerable extensions for
Rails:
Have a look at the following code:
class Invoice < ActiveRecord::Base
has_many :invoice_lines
def total
invoice_lines.sum(&:total)
end
end
class InvoiceLine < ActiveRecord::Base
belongs_to :invoice
def total
amount * price
end
end
Now, when calling invoice.total, I get wrong
2006 Jun 06
3
Invoice and invoice_lines
Hello People,
I have a possibly very lame question.
I am fairly new to RoR, and I want to make sure I do it "right".
I have a model called Invoice, and one called InvoiceLines. Usual story:
the table "invoice" has a 1:n relationship with "invoice_lines", which
includes invoice_id.
Now... the application will have a "new order" button, which will allow
2009 Jul 14
1
How to add after_filter-style render
Hello
I would like to execute specific action rendering something into page
after each of my ajax calls. In example I would like to update some
div or display an alert.
How I imagine it could work is as follows
class ApplicationController < ActionController::Base
after_filter :do_something_after_each_ajax_call
def do_something_after_each_ajax_call
if request.xml_http_request?
2009 Mar 23
1
Ajax not defined.
This is my code and I am trying to call remote function when somebody
click on add button after selecting something from select_tag. Please
tell me where I am wrong ? I am getting following error: Ajax not
defined.
<input type="button" value="< Add" class="button" onclick="<%=
remote_function(:url => {:controller => ''users'',
2010 May 06
3
Possible bug in chan_sip:add_sdp
Am I missing something here? I see
if (needvideo) { /* only if video response is appropriate */
add_line(resp, m_video->str);
add_line(resp, a_video->str);
add_line(resp, hold); /* Repeat hold for the video stream */
} else if (p->offered_media[SDP_VIDEO].offered) {
snprintf(dummy_answer,
2013 Feb 09
1
R maps Help
I am fairly new to R and am plotting flight data on a map. Everything is
working well except the size of the map is really too small to show the data
effectively and I can't seem to figure out how to make the output map
larger. Do I need to change the device characteristics or is it a map.???
call. Here is the code:
library(maps)
library(geosphere)
airports <-
2006 Aug 23
4
Ferret 0.10 and Fields
Hey ...
I just tried to convert my code to 0.10 .. But i''m currently not sure
how to use fields..
i really like some of the new api.. its leaner and i like the fact that
these strange consts are gone (like
Ferret::Search::BooleanClause::Occur::MUST) ..
I see that you''re now having Ferret::Index::FieldInfo to describe the
fields of the index.. thats good.. and i now see that
2007 Oct 05
13
spec''ing view render partial collection, local variable not found
I''m trying to spec out a render partial collection but I get the following
error
2)
NoMethodError in ''/games/_game.rhtml should show game name''
undefined method `body'' for #<#<Class:0x316580c>:0x2f1154c>
/Volumes/EXTERNAL/web/omenking.ca/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/have_text.rb:12:in
`matches?''
2007 Oct 06
4
spec''ing views, mock_model associations
I writing a spec that returns the count of how many players in a game:
it "should how many players in a link to all players" do
render :partial =>"games/game", :object => @game
response.should have_tag(''a'',"(2) Players")
end
I''m not sure how to do the mock model, I think it would be done two ways but
unsure of the syntax:
1: add
2007 Dec 29
15
Do you think it would look cleaner?
I was looking over some of my specs.
I was thinking that the following:
@game.should_receive(:name).and_return(''The Battle for Blaze'')
@game.should_receive(:people).and_return(5000000)
@game.should_receive(:activated).and_return(true)
Would it look cleaner if I could do this instead?
@game.should_recieve_and_return(
:name => ''The Battle for Blaze''
2006 Jun 07
0
using inline insert_html to generate uniquely named elements
Hello all,
I?m using some inline rjs to add content with a unique id like so:
In the <head>:
function add_fields() {
html = ''<div id="'' + new Date().getTime() + ''">'';
html += "<%= escape_javascript(render :partial => ''field_set'')
-%></div>";
new Insertion.After("whatever", html);
}
In
2006 Aug 25
3
RJS Error: Element.update is not a function
Hi,
I have implemented some RJS code and I have the same exact code in 2
different places. In one place I get the error "Element.update is not
a function" and the other place works fine. Any idea why this error is
coming? Breaking my head.
-Vinod
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on
2012 Jul 07
5
number of decimal places in a number?
Dear R users,
I need a function that gets a number and returns its number of actual decimal places.
For example f(3.14) should return 2, f(3.142) should return 3, f(3.1400) should also return 2
and so on. Is such function already available in R? If not, could you give me a hint how to achieve that?
Many thanks in advance.
-----------------------------------------------------------------
2008 Aug 03
7
New game "Das schwarze Auge: Drakensang"
Hello Wine Users,
I am thinking about buying the game "Das schwarze Auge: Drakensang" (German homepage (http://www.dsa-game.de/), English homepage (http://www.drakensang.info/)). But I will only do it if I am able to play it under Linux. Does someone have the game already and tried to get it running with Wine?
Regards,
Benjamin
2008 May 25
11
Install components
Is it possible to install stuff like frameworks and directx etc?I'm especially interested in the directx part?
2010 Oct 09
2
Rails 3 upgraded form validation issue
H All,
I have run into a very interesting issue. On one of my apps, after upgrading
from 2.3 to 3.0, the form validation started to escape html. Normally what
should happen when you submit a form and one of the fields fails validation
that field would get surrounded with a <div class="fieldWithErrors"> and so
on. That seems to be broken in my app and what I get is the correct html
2020 Sep 19
4
CentOS 8 Install as DOMU in PV Environment
Hi,
In general, PV tends not to be supported in newer distribution releases.
This is mostly due to HVM performance and flexibility nowadays, which
just was not the case back in the days when PV ruled.
I am curious why you are trying PV.
-yoctozepto
On Sat, Sep 19, 2020 at 6:41 PM 9f9dcad3f78905b03201--- via
CentOS-virt <centos-virt at centos.org> wrote:
>
> All,
>
> Just
2015 Apr 08
4
SIGTERM signal to qemu-kvm process
Hi
I am using QEMU 0.12.1 as the hypervisor in my RHEL installation of 6.5.
I wanted to know if there are any side-effects with respect to VM image
corruption when i use SIGTERM signal to kill a qemu-kvm process which
effectively stops my VM running on the host.
Appreciate if you can provide me some valuable information in this regard.
Thanks
Jatin
2015 Mar 26
0
error code 1 while using syslinux
>
> syslinux4.exe -maf G:
> Return code : 1
> Output :
> Error : Could not write the whole boot sector
>
In addition to my comments in my prior email in this same email thread,
(FWIW and for other readers) I should add that for latest version 4.xx
and onwards, a more-adequate command should had been:
syslinux[64].exe -mai <drive_letter>:
and reflecting the original
2018 Jan 29
1
Dovecot 2.3.0 assertion failure on LMTP delivery
Hi Aki,
Please see below:
Thank you
-Nick
# gdb /usr/libexec/dovecot/lmtp ./3445
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `dovecot/lmtp'.
Program terminated with signal 6, Aborted.
#0 0x00007f297814d1f7 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install dovecot-2.3.0-8.cp1162.x86_64
(gdb) back
#0