Displaying 20 results from an estimated 600 matches similar to: "Class variables in templates/layouts"
2006 Jul 18
4
Multiple Layouts - Single Controller
How do I do multiple layouts for a single controller:
I am aware I can do... render(:layout =>''mylayout'') for individual
actions, however this becomes a multiple render problem.
I tried this...
layout "mylayout", :except => [:myaction, :myotheraction]
layout "myotherlayout", :only => [:myaction, :myotheraction]
However that doesn''t
2006 Jun 27
2
Using a different layout/styleshheet
Hi,
I have a view that I use to display and capture data. Once the user
has input the required data, I then need to be able to print the view.
I know that I can setup a stylesheet to take care of the page layout
but it is not clear to me how I will make the print view call the new
layout.
If anyone could clarify this or point met in the right direction, I
would be most grateful.
Regards,
Paul
2006 Dec 28
0
Localization using inheritance
Hi!
I''m trying to implement localization using inheritance, i.e.:
class ParentController < ApplicationController
layout "mylayout"
def initialize
#do something
end
def index
#do something
end
def search
#do something
end
# ...
end
Controller do his job and render page using "mylayout" and views from
"/view/parent"
2009 Feb 12
3
getting all pairwise combinations of elements in a character string
I'm able to do this as follows, but am wondering if anyone knows a
simpler way which still avoids explicit loops?
> (mystring <- letters[1:5])
[1] "a" "b" "c" "d" "e"
> unlist(sapply(mystring[-length(mystring)],
+ function(x)
paste(x,mystring[(grep(x,mystring)+1):length(mystring)],sep="")))
a1 a2 a3
2006 Jul 03
9
checkboxes
in the mean time i am using a checkbox like this :
<input type="checkbox" name="var[car]" <%= var.car ? ''checked'' : ''''
unless @var == nil %> />
but i am sure there is something better than this in rails like
<%= checkbox_tag ''var'', ''car'', :checked => true %>
but this is not
2011 Feb 13
3
String manipulation
Please consider following string:
MyString <- "ABCFR34564IJVEOJC3434"
Here you see that, there are 4 groups in above string. 1st and 3rd groups
are for english letters and 2nd and 4th for numeric. Given a string, how can
I separate out those 4 groups?
Thanks for your time
[[alternative HTML version deleted]]
2007 May 28
2
[LLVMdev] Problem in llvm gcc back-end
HI,
While I testing some code, I found some problem on Union handling.
I've wrte following test code, and it has union assignment.
The code's output is
from pointerToUnion: chars mystring, length 64
from original: chars mystring, length 8000
It's caused by second char member(charlength) of LongestMember.
For union assignment, llvm-backend seems generates assigning each
member of
2006 Jul 07
3
Newbie Model question (HABTM?)
All,
If I have a table that has several discrete fields that all point to
the same associated field, how do I model it.
Specifically,
If I have a project table that has 2 fields: specifying_company, and
responsible_company.
And one table of associated companies, how do I do the :belongs_to /
:has_many stuff
ie. For a given project company A may be writing the spec, but company
B may be paying
2011 Aug 04
3
#create tests fail when I add FriendlyId to my model
I am doing controller testing, and I can''t seem to get the create
method test to pass when friendly_id is added to the mix. If I comment
it out of the model, the tests all pass perfectly. The moment I add it
back in, the error looks like this:
1) Error:
test_create_valid(BrandsControllerTest):
FriendlyId::BlankError: FriendlyId::BlankError
2010 Mar 26
6
Rake argument error
Hi,
I''m having a problem loading a sample data with simple rake command.
rake db:fixtures:load
When I run the above command,I get the following error
$rake db:fixtures:load
(in /home/raghu/www/photos)
rake aborted!
a YAML error occurred parsing
/home/raghu/www/photos/test/fixtures/photos.yml. Please note that YAML
must be consistently indented using spaces. Tabs are not allowed. Please
2006 Aug 14
4
Test for string in string
Hi,
Is there an easy way to test if a substring exists in a string?
I''m using this check:
if mystring.index(substring) > 0
but it doesn''t seem to be working....
Thanks!
--
Posted via http://www.ruby-forum.com/.
2007 Nov 20
3
How to test views with Nested Resources and Partials
Hi everyone,
I am relatively new to rspec and I am running into a wall in testing my
views. I have a RESTful resource Contracts with a nested resource of
Line_items.
I am trying to figure out how to test the "edit" form of the Line_items.
What complicates this is the nested routing and how to account for it,
and that there is a partial form (_form.haml) that both the edit.haml
and
2008 Aug 06
2
matching problem
I have a matching problem that I cant solve.
mystring = "xxx{XX}yy{YYY}zzz{Z}" where "x","X","y","Y","z","Z" basiclly can
be anything, letters, digits etc. I'm only interested in the content within
each "{}".
I am close but not really there yet.
library(gsubfn)
strapply(mystring,"\\{[^\\}]+",, perl=F)
2010 Dec 06
10
testing chapter: agile web dev withrails
I am working my way through Agile web development with rails and I''m in
the testing chapter.
when I run the following test(or any other test)
I''m new and not sure where to start looking.
require ''test_helper''
class ProductTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
I
2011 Oct 05
1
Weird behaviour of tab characters in a string in R (vs Python)
Hello,
I wanted to parse some information from a text, where fields are tab
separated.
When I copy the text into an R session (under emacs) like:
mystring <- "field1 field2 field3"
the tab character is replaced by a single space!
For ex, if I type mystring, I get:
"field1 field2 field3"
The tabs have disappeared!!!
I checked with Python that the text I copied was tab
2012 Jan 04
1
Warning message about closing a connection XXXX
Hello everyone,
After running the following code, I obtain this error message.
> mydata <- read.table(textConnection(mystring),
+ header=TRUE, sep=",",
+ row.names="id", na.strings=" ")
> mydata
Warning message:
closing unused connection 3 (mystring)
=====
However, when I attempt to run read.table() again and immediately submit
the close() function
2010 Feb 08
2
the hat ^ in regular expression
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?...
Nom : non disponible
URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20100208/52a6d080/attachment.pl>
2006 Jun 07
3
function to be used in model
Where is the best place to put a function that will be used in both
several controller and several models?
--
Posted via http://www.ruby-forum.com/.
2010 May 08
2
[LLVMdev] Should the function operand flag 'sret' match the flag in function declaration?
I have these two instructions, first one inside some procedure, second
one is an outside declaration.
Code verification passes and it runs, but incorrectly.
Every time I saw such situation coming from c++ compiler, attributes
'noalias sret' appear on both call and declaration.
Does such situation make sense, or (as I guess it is) a bug in verifier?
I think verifier should match at
2006 May 03
3
Graceful degrading AJAX show/hide
Ok i''ve done a bit of hunting around and I can''t find much
documentation on how ensure an ajax call through an rjs file degrades
with javascript off.
Essentially, if javascript is off, I want to refresh the page and pass
a variable from the controller to the page the user is on. Not use the
rjs file.
At the moment i have this:
<%= link_to_remote("Advanced Search",