Displaying 20 results from an estimated 4000 matches similar to: "HOW TO: Easily output alternating item styles via metaprogramming"
2006 Feb 20
2
Alternating Table Row Colors
Does Rails have built in support for alternating table row colors?
Thanks,
Sam
2008 Nov 13
3
metaprogramming with lm
Hello,
Say I want to make a multiple regression model with the following expression:
lm(y~x1 + x2 + x3 + ... + x_n,data=mydata)
It gets boring to type in the whole independent variables, in this
case x_i. Is there any simple way to do the metaprogramming for this?
(There are different cases where the names of the independent
variables might sometimes have apparent patterns or not)
2005 Dec 30
1
metaprogramming in controller: accessing instance variables
Hi all,
I''m trying to move a bunch of methods out of a controller into a
library that I can include and call a class method to have it
dynamically add a bunch of methods to the controller.
The goal is to just add to each controller:
include UIEnhancements::SubList
sub_list ''Note'', ''incomplete''
and have the sub_list method create all the methods
2013 Feb 02
1
How to set css styles with variables in rails if certain item is selected?
I''m doing the Ryan Bates Sortable Table Columns screencast
If the item is a table and I want to a style if the item is selected how
can I do it?
Attachments:
http://www.ruby-forum.com/attachment/8101/sortable.txt
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To
2010 Dec 21
5
Rails, Ruby, haml, metaprogramming problem
In HAML I have hundreds of lines like the following:
- xyz = someFuncThatReturnsString(''xyz'')
and elsewhere
%div{''id'' => xyz}
The above lines work fine.
- - -
Attempting to keep things DRY (Don''t repeat yourself) I want to do
something like
- eval(otherFuncThatReturnsString(''xyz''))
where
2006 May 15
1
Simple: How to use TextHelper in a controller
I''m having trouble succesfully getting access to the
ActionView::Helpers::TextHelper.strip_tags
method from one of my controllers.
If I try to call it directly using
ActionView::Helpers::TextHelper.strip_tags
I get
undefined method `strip_tags'' for ActionView::Helpers::TextHelper:Module
What is the preferred way to make ActionView helpers available to a
descendant of
2006 Aug 10
3
Want to use a view helper (TextHelper) in a model class
I have a model that deals with HTML and I want to use the
text_helper.sanitize method to strip the HTML of Javascript.
However, it doesn''t appear that I can get easy access to the text_helper
methods from within a model.
Anyone have any suggestions for how to do this?
In general, I think that there are some ActionView helpers which are
generic enough to want to use in a model class.
2006 May 16
3
Best way to handle namespace collisions?
All,
I have a little namespace collision here. I am trying to use both
RubyfulSoup (an HTML parser - which I highly recommend by the way) and
the ActionView::Helpers::TextHelper class. Within the TextHelper class,
there''s an attempt to create a new "Tag" object. However, Tag is also
defined in the RubyfulSoup gem and it is _this_ Tag class whose
initialize method is
2006 Nov 04
0
traits-0.9.2 - better living through metaprogramming
URLS
http://rubyforge.org/projects/codeforpeople/
http://codeforpeople.com/lib/ruby/traits
ABOUT
traits.rb is set of attr_* like methods on steroids, caffeine, and botox. it
encourages better living through meta-programming and uniform access
priciples. traits.rb supports smart inheritence of class attributes and a
fistful of hooks for veryifying and munging attr values.
2006 Jan 09
3
XSS prevention with Rails
Hi!
I wanna take a stab at implementing better XSS prevention for Rails.
This time for real =)
I''m wondering what would be the better way, clean everything up with
tidy first and then do the rest with regexp or regexp all the way?
Anybody done this before?
Thanks!
Ciao!
Florian
2006 Feb 25
7
Help with DRY: too much code in my view
I''m a newbie to rails, and really to the whole DRY and MVC thing as
well, except where I accidentally fell into things doing it my own way
in the past.
I''ve got a fairly complex DB structure I want to create an interface for
using Rails. Getting simple tables to display, edit, save, not too much
problem there. But where I''m having trouble is figuring out where to
2009 Jan 06
1
How to access text helper and url helper methods in model
Hi,
I want to access TextHelper and UrlHelper methods in my model so how i
am able to access it ?
I was included following helper in my model but still it is not
working? also for accessing these helper method w need to give external
reference?
E.g.
class Xyz
include ActionView::Helpers::TextHelper
include ActionView::Helpers::UrlHelper
Also
2009 Jan 01
2
Ruby on rails API website suggestion
I would like to request a feature.. like: http://rubyonrails.org/function
and it
will search inside http://api.rubyonrails.org for the function and
show it.
Like PHP has.. http://php.net/basename
Example: http://rubyonrails.org/truncate and it will points to
http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M001541
That woul be cool.
Thanks
2009 Jan 01
2
Ruby on rails API website suggestion
I would like to request a feature.. like: http://rubyonrails.org/function
and it
will search inside http://api.rubyonrails.org for the function and
show it.
Like PHP has.. http://php.net/basename
Example: http://rubyonrails.org/truncate and it will points to
http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M001541
That woul be cool.
Thanks
2006 Feb 10
4
RegEx Question
Hi,
This is more of a Ruby question than Rails. I want to autolink url''s in a given
string. I''m not great with regular expressions and I wandered if anybody has an
example. Thanks.
2006 Apr 15
3
Dumb newbie question - text formatting?
I have a MySQL "text" element that I''m trying to display, but it''s not
formatting (i.e. it''s all one big paragraph). In the AWD depot example
it doesn''t look like they do anything special, but they get formatted
text. I''ve tried it with both:
<%= show.description %> - puts text, and formats according to any HTML
tags I typed in.
2005 Dec 14
1
writing an MDA, help me avoid corrupted indexes
Hello.
First, I want to thank those responsible for Dovecot IMAP as it was a
real treat to implement in comparison to my mostly-failed attempts with
Cyrus. The passwd-file authentication was exactly what I needed as I
really didn't want to have to deal with PAM or LDAP but where I am
setting up a server with virtual accounts.
I'm using Postfix as an MTA, and it quite handily passes
2008 Jan 22
4
newlines in text_area
Hi @ all
I would like to enter a text with a text_area into the database. It runs
excellent. But when I want to show the entered text in the show view,
all newlines (paragraphs) are deleted and the text is only one block.
How can I save the returns (newlines) too?
Thanks for helping!!
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received
2007 Nov 29
27
Strip & Sanitize BEFORE saving data
So I''ve googled my brains out, and I see a lot of talk about
TextHelper for views, but next to no discussion about cleaning text
_before_ it is saved.
I figured this had to be asked 4 zillion times, but I''m not finding
anything concrete/obvious.
Using h is fine as a safety catch, but that alone is not acceptable
to me as the means of diffusing the impact of HTML or JS
2006 May 02
6
Is there a link_to ''external url''?
I''ve checked the Rails documentation but find no mention of link_to
''external url'' or equivalent. Does rails have a built in method to do
this?
thanks
-Lindsay
--
Posted via http://www.ruby-forum.com/.