Displaying 20 results from an estimated 1200 matches similar to: "Stubbing helpers"
2007 Jul 14
2
Using Helpers inside a Controller
I want to use helpers inside a controller method for an AJAX
application. After the page is loaded and displayed, there will be an
asynchronous javascript request to load additional resources such as
html forms and other data.
The controller which handles the request will collect the resources and
send them back in json format.
def get_resources
data=Hash.new
data[:form1]=form_helper1()
2013 Feb 03
4
Create a helper for models and views?
Hi!
If I have a method that is useful in both models and in views, where would
be the appropriate place to put it?
The method in question just takes two dates as strings, tries to parse them
and returns all dates in the range between them. It also takes care of the
issues when the dates are badly formatted etc etc..
This method is being used in several models (so a simple class method in
2006 Apr 19
8
Module and Model
I am getting the following error
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1129:in
`method_missing'': undefined method `directory?'' for Msg::File:Class
(NoMethodError)
I have a model called Msg::File in models/msg/file.rb, and I have a file
in lib/msg/helper.rb which references to both Msg::File and
File.directory?
How do I help activerecord
2007 May 21
4
Just upgraded to 1.0.0, should render_text isn''t working for me
I finally got around to upgrading from 0.8.2 (!!). I had a spec which
looked like
specify "should render abc123" do
controller.should_render :text => "abc123"
get :key
end
With 1.0.0, the new spec is
it "should render abc123" do
get :key
response.should render_text("abc123")
end
However it doesn''t work, giving me the error:
undefined
2006 Apr 08
2
Cannot use view helpers in RJS helpers
Any ideas why I would get an error in a RJS helper on view helpers
such as number_to_currency.
Example:
# my_template.rjs
page.help_me
# my_helper for my_controller
def help_me
number_to_currency(10)
end
I have also tired page.number_to_currency but that doesn''t work either.
Cheers,
Nicholas
2006 Jun 07
6
Links on the left hand side - are components necessary?
Hello,
Maybe this is super-trivial...
I need to have a list of links on the left hand side of my application,
for *every* single page.
So, I''ve created a layout called "main" (main.rhtml) under
view/layouts, and included >layout "main"< in pretty all of my
controllers.
main.rhtml has, amongst all the other HTML stuff:
<%= render_component
2006 Feb 25
1
extending a class
I''m trying to add this to my project:
class String
def escape_quotes
self.gsub(/["'']/) { |m| "\\#{m}" }
end
end
I tried putting it in application_helper.rb, but it''s not getting found.
Where does it need to go?
Thanks,
Chris
--
Posted via http://www.ruby-forum.com/.
2006 Mar 04
13
Using helpers from controllers ?
There is a solution to use helpers from controllers ?
I have an error :
|undefined method `content_tag''|
class ApplicationController < ActionController::Base
def test
return content_tag("a","test")
end
end
2008 May 13
1
Hard(?) lock when reassociating ath with wpa_supplicant on RELENG_7
I seem to be able to lock my machine by going into wpa_cli and asking it
to 'reassoc'. The reason for question mark after "hard" is that debug
information (caused by wlandebug and athdebug) is being printed on the
console. The only way to get machine's attention is to hold power button
for 8 seconds.
Note: manual reassociation is just the handy way to reproduce the
problem
2006 Mar 20
0
Using render within plugin.
I am very, very new to rails (and ruby) and am working on a view
extension helper method. In a template I have
<%= my_helper params %>
my_helper does some system calls and ends up placing an image file in
the public images folder (which I referenced within the plugin using
RAILS_ROOT). I want the helper to then return an appropriate image link
to the template. I want to use the
2006 Aug 10
2
atheros chips dangerous?
Hello,
Possibly some of you will have read the news about "Hijacking a
Macbook in 60 Seconds or Less"[1]. At this time I was searching
a wireless card for my server and I wonder how this can affect
to the combination FreeBSD+ath(4).
The ath_hal page states that FreeBSD use a binary driver and
I think it is located in this file[2].
Unlike OpenBSD which affirms that they have
2006 Aug 16
4
Accessing Constants Declared in Helper Modules
Hello all,
I''m having great trouble accessing a constant declared in a helper for
one of my view templates. I am trying to create a grouped selection list
based on a predefined set of values. Rather than declare this set of
values in the view, I wanted to put it in the helper that automatically
gets included for the view. Unfortunately, it doesn''t seem to work.
All methods
2006 Jun 16
3
Not able to recognize helper class method in controller!
Hi,
Not able to recognize helper class method in controller!
When I try to call some method "get_formatted()" in my controller, it
says local method not recognized.
Please help me out.
Thanks,
josua
--
Posted via http://www.ruby-forum.com/.
2005 Feb 17
4
multiple crypto accelerator cards in one FreeBSD box
Hi there!
we are thinking of deploying a IPSEC VPN concentrator using multiple PCI bus
version VPN1401 cards in a FreeBSD box using hifn support..
From the technical specs in Soekris website
http://www.soekris.com/vpn1401.htm,
each card can support 24 to 70 connections. The question is if we
put 3 VPN1401 cards in a single box, does this mean the FreeBSD box can support
3 x (24 to 70) IPSEC
2003 Oct 21
2
hardware crypto and SSL?
Is anyone successfully using some sort of hardware crypto solution to
combat the overhead of SSL in http transactions? I'd love to hear
anything good or bad about this.
-Bill
--
-=| Bill Swingle - <unfurl@(dub.net|freebsd.org)>
-=| Every message PGP signed
-=| PGP Fingerprint: C1E3 49D1 EFC9 3EE0 EA6E 6414 5200 1C95 8E09 0223
-=| "Computers are useless. They can only give you
2006 Apr 25
3
Freebsd Stable 6.x ipsec slower than with 4.9
Hello List,
I have to dualcore Athlon 64 4800+ systems. Initially I was running 4.9
on both of them an was able to get 54mbits thru direct connected realtek
10/100 cards as measured by nttcp.
I put stable on one of the system and now can on get 37mbits as measured
by nttcp when going thru an ipsec tunnel.
Eliminating the tunnel I get 94mbit/sec.
Ideas as to why this is happening?
Also
2006 Mar 01
0
TextHelpers in Controller?
I have a controller that saves info to the DB. It''s based on the AJAX
scaffolding code. All I want to do is add a simple_format() function to
it before I save a user-edited text field to the DB. TO convert line
returns to <br>s, etc.
@project_note = ProjectNote.new(params[:project_note])
@project_note.body = simple_format(@project_note.body)
Since this happens in a controller,
2003 May 11
1
iHEADS UP: ipsec packet filtering change
On Sun, 23 Feb 2003 09:47:05 -0800, "Sam Leffler" <sam@errno.com> said:
>
>> Add a new config option IPSEC_FILTERGIF to control whether or not
>> packets coming out of a GIF tunnel are re-processed by ipfw,
>> et. al. By default they are not reprocessed. With the option they
>> are.
>
> This may affect your ipfw/ipf rules. If you are happy with
2007 Jul 06
3
stubbing helper methods for View specs
Hi there
I have several view specs, that include the following snippet in
their "before" block to stub the methods by acts_as_authenticated
before :each do
@u = mock_model(User)
@u.should_receive(:name).and_return("Hans Muster")
template.should_receive(:logged_in?).and_return(true)
template.should_receive(:current_user).and_return(@u)
end
this
2006 Oct 04
0
stubbing/partial mocking
All,
Brian Takita has been contributing to a stubs branch to support
stubbing and partial mocking on Modules (and therefore classes). I
tweaked the syntax a bit and merged it into the trunk, so you can
update from the trunk and check out the new stubbing/mocking love. If
you prefer to wait for a release, there should be one coming soon-ish
(I''m aiming for later this week).
As Brian