Displaying 20 results from an estimated 7000 matches similar to: "How to use helpers in layouts?"
2005 Jul 22
3
testing application_helper.rb
I am trying to run some functional (or are they unit?) tests on my
application_helper.rb. So far, I''ve not had any success in being able
to call the methods defined in application_helper.rb.
Here is my app/test/functional/helpers.rb
require File.dirname(__FILE__) + ''/../test_helper''
require File.dirname(__FILE__) +
2006 Feb 07
0
scope problems testing a helper method that calls link_to()
We''ve been having problems writing functional tests for helper methods
that rely on ActionView methods. Here''s a specific example.
In application_helper.rb I''ve got a method called ''party_link()¨:
def party_link(party)
link_to party.full_name, { :controller => ''contacts'',
:action =>
2007 Jul 31
11
helper spec not finding rails core helpers
Hi,
My helper specs were going ok until I added a call to a rails
DateHelper method in one of my helpers
http://api.rubyonrails.com/classes/ActionView/Helpers/
DateHelper.html#M000574
The helper runs fine from my view templates, just dies in the spec test.
I boiled my question down to a simple (not too useful) example. I''m
not sure what I''m missing.
#
2006 Jun 22
2
rails on Oracle 10g - missing controller ?
I am trying to generate my first scaffold but I am getting a 500 error
from http://127.0.0.1:3000/foo . Below is the information about my
system, as well as the commands I am typing. I have also included the DDL
( Oracle 10g ). I am mid way through chapter 6 of "Agile Web Development
w/ Rails". Why aren''t there any files under app/controllers/ ?
C:\tmp\rubyWork>ruby
2006 Nov 05
1
diag()<- in Matrix?
Dear all,
I am trying to use the Matrix package to do some calculations on rather
large and sparse matrices. An example of such a matrix is given below.
mig<-0.2
side<-10
np<-side^2
mig.mat<-matrix(0,np,np)
diag(mig.mat[1:(np-side),(side+1):np])<-mig/4
diag(mig.mat[(side+1):np,1:(np-side)])<-mig/4
diag(mig.mat[-np,-1])<-mig/4
2008 May 20
2
DateHelpers .. don' display.. ?
HI
I don''t understand what happen ..
if I use the script/console :
>> include ActionView::Helpers::DateHelper
=> Object
>> include GLoc
=> Object
>> time_ago_in_words(Time.now, include_seconds = false)
=> "moins d''une minute"
I get the correct answer..
but I I write in my view
<%= time_ago_in_words(Time.now, include_seconds = false)
2020 Jul 20
2
[PATCH v2 2/5] mm/migrate: add a direction parameter to migrate_vma
On Mon, Jul 13, 2020 at 10:21:46AM -0700, Ralph Campbell wrote:
> The src_owner field in struct migrate_vma is being used for two purposes,
> it implies the direction of the migration and it identifies device private
> pages owned by the caller. Split this into separate parameters so the
> src_owner field can be used just to identify device private pages owned
> by the caller of
2019 Nov 12
1
postfix + spamassassin + dovecot-lda (with sieve support)
Hello,
I have FreeBSD 12 server with postfix + spamassassin. Old config work
fine.
------ old postfix master.cf
spamfilter unix - n n - - pipe
flags=R user=nobody argv=/usr/local/bin/spamc -e /usr/sbin/sendmail -oi
-f ${sender} ${recipient}
------
I try to add dovecot-lda (with sieve support) as local delivery agent to
postfix config
----------- postfix master.cf
# Spamd filter
spamfilter
2011 May 10
7
Webrick script/server file does not exist
Hello all,
I worked fairly enough with PHP and MySQL, but am very new to Ruby.
I have Windows machine with Apache and MySQL installed previously.
Both Apache and MySql were stopped while installing Ruby.
I tried several ways to install Ruby 1.8.7 and one-step installer.
I can use Ruby with netbeans 6.0.1 with its own Ruby or with the one I
installed now.
The problem starts when I try to create
2006 Apr 27
2
How to override pagination_links method
I intend to override pagination_links method.
I added following lines of code in application_helper.rb
module ActionView
module Helpers
def pagination_links(paginator, options={}, html_options={})
raise("boom!!")
end
end
end
But my code is not executing my code. The view is still using the method
pagination_links from rails.
What''s the correct way to override
2002 Oct 08
3
repeated measures help; disagreement with SPSS
Hi, all.
I have a simple design I'm comparing to output from SPSS.
the design is 1 repeated measure (session) and 1 between measure
(cond). my dependent measure is rl. here is the data I'm using (in a
data.frame):
mig <- data.frame(subj=factor(rep(subj,3)),
cond=factor(rep(cond,3)),
session=factor(c(rep(1,nsubj),rep(2,nsubj),rep(3,nsubj))),
2010 Aug 17
2
Independent variables omitted in lm and glm
Dear List,
Some independent variable were missing in calculation using lm and glm
(gaussian).
(X= Y1+Y2+…..+Y16, Independent number: 16 variable)
However, those variables did work well in cor(X, Y) respectively.
str(dataframe) was also run to ensure that the variables were all numbers.
Moreover, the missing variables were different in lm and glm.
In lm, 3 factors were not taken into
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
2007 Jul 24
4
spec''ing helpers that use controller
Hi all,
I''m in the process of creating rspecs for my helpers. One of the
helpers in app/helpers/application_helper.rb looks like this:
def page_name
@page_name || "Define @page_name in
#{controller.controller_name}::#{controller.action_name}"
end
The rspec is simply:
it "should something" do
page_name
end
2006 Jul 20
5
RJS where to put helper method?
Hi,
If I want to have helper method for my rjs, where''s the best place to put
it?
so for example:
--- bla.rjs:
page.replace_html ...
page.visual_effect ...
--- somewhere: (currently I put in application_helper.rb)
def replace_with_effect(page)
page.replace_html ...
page.visual_effect ...
end
--- bla.rjs:
replace_with_effect page
and is there a way to define the helper so we
2008 Jun 08
3
Plugins - helper function is an "undefined method", Objects "can't be referred"
I''m modifying a shopping cart plugin, MinimalCart, and for some reason
I can add one item to the cart multiple times, but as soon as I add a
second item, all kinds of strange things start happening.
An actionview::template error is thrown because a method defined in
application_helper is "undefined"
What could cause a defined application helper method to all the sudden
not be
2006 Mar 04
2
application_helper can "include" another helper ?
My "application_helper.rb" become to large.
I have basic functions that I use for all projects.
Is it possible to define thoses functions inside an external
"basic_helper.rb" and include it in "application_helper.rb" ?
2006 Jul 11
0
better way to include helpers into application controller/test_helper?
Right now, I have the following in my application controller - and a
simliar version is duplicated in test_helper. There must be a better
way to include common functionality like this that gets used across
layers? Maybe at the very least a way to include it at the class
level and instance level with one line?
# provide access to text helper at class level
def self.text_helper
2009 Feb 20
6
rails 2.2.2 does not work with ruby 1.9.1
Hi everyone! I''ve installed new Ruby 1.9.1 from sources
(http://www.ruby-lang.org/en/), then "gem install rails", everything was
ok during installation, all tests ("make test") were ok too.
After all, i wanted to create my new RoR project, but I could not start
it.
Plz help me
Here is my terminal:
[renat@localhost rails]$ rails mysite
create
create
2006 Jul 21
5
How to display data using helpers and collections
## application_helper.rb
def name_field(object, options = {} )
html = ""
html << "Title : " + select(object, ''title'')
html << "Given Names :" + text_field(object, ''given_names''
html << "Family Name :" + text_field(object, ''family_name''
html
end
## index.rhtml
<div