Displaying 20 results from an estimated 5000 matches similar to: "Alternating Table Row Colors"
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
2007 Jul 03
5
HOW TO: Easily output alternating item styles via metaprogramming
I always need to apply alternating item styles when outputting a collection,
here''s what I''ve been using recently.
In the app helper I define this method:
def alternate(items,alt=false
items.map{|i| i.class}.each { |k| k.class_eval {attr_accessor :alt}}
items.each { |i| i.alt, alt = alt, !alt }
end
When I call the partial I wrap the collection with this method:
2005 Dec 31
7
Dynamic form? Not really!
Hi guru''s out there,
Im happilly coding my first rails app, and all goes well. I find myself
manually coding in a particular field all the time (company_id), that relates
the contact to a company. The total coding of this form seems somewhat much.
Could somebody tell me what Rails power I''m possibly missing and stuborn as I
am trying to do myself?
I was wondering if the
2006 Feb 11
7
Menu Helper
Hi all,
I''m trying to add a common menu to all pages in my application. It is
just a set of links I want to display. I''m having trouble deciding
where to put the code. Below is what I''ve tried to get out of the "Four
Days on Rails" tutorial but no luck. Any help would be appreciated. Am
I on the right track?
Thanks,
Sam
2006 Jun 24
2
:limit => Parent / Child Relationship
Hi all,
I trying to find the best way to do the following and I''ll use a blog
with comments for an example.
Blog has many comments
Comments belongs to blog
My question is how to limit the number of comments (child) records read
for each blog (parent) record. Most of the solutions I''ve come up with
are limiting the number of records displayed within the views but the
2010 Oct 20
3
combine vectors in an alternating way
I have two vectors
min
0.2, 0.3, 0.6, 0.1
max
0.4,0.5,0.7,0.4
Is there a way to combine these two vector so that the values will be taken
from the vectors alternating so that I will get a new
minmaxminmaxminmax-vector?
minmax
0.2,0.4,0.3,0.5,0.6,0.7,0.1,0.4
Any help is much appreciated
--
View this message in context:
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 Mar 29
4
:through alternate
I''d like to use :through to create a web of associations like:
class Thing < ActiveRecord::Base
has_many :child_things, :through => :thing_thing
has_many :parent_things, :through => :thing_thing, :some_other_option?
end
class ThingThing < ActiveRecord::Base
belongs_to :thing
belongs_to :child_thing, :class_name => ''Thing'', :foreign_key =>
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 Feb 27
12
RedCloth
Is this the prefered method to implement RedCloth in your views. I''m
trying to display user input that will sometimes have code references in
it. This strips out all tags. I would like for the tags to be
displayed but not read as html.
Thanks in advance!
<%= RedCloth.new(strip_tags(comment.comment),[:filter_html]).to_html %>
charlie bowman
recentrambles.com
--
Posted via
2009 Feb 04
1
How to hack a mongrel cluster to restart in an alternating manner?
Hello,
I''ve been trying (unsuccessfully) to hack my mongrel_cluster to re-ststart
in an alternating manner.
Specifically, this soluiton:
http://blog.carlmercier.com/2007/09/07/a-better-approach-to-restarting-a-mongrel-cluster/#content
Which means I an call to mongrel_rails cluster::restart to do this:
mongrel_rails start 8001
mongrel_rails stop 8001
mongrel_rails start 8002
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
2012 Feb 07
1
alternating element in url
Hey everybody,
it would be really appreciate if you knew the solution to the following
problem.
I am trying to load data from the internet into R without having to save
them. However, I need to acess a different website for each dataset. So I
want to alternate an element in the URL. Eventually, I want to fill a 3
dimensional matrix/array where each slice is a two-dimensional matrix from
the
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
2006 Jul 28
11
Forum
Im making forum and i have problem with paths.
Here is code:
http://pastie.caboo.se/6389
With this code, it works. But its a bit weird to use so many paths
function. For every path i need to make new function. So can you suggest
me something.
Tables are like here:
http://wiki.rubyonrails.com/rails/pages/ForumExample
--
Posted via http://www.ruby-forum.com/.
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 May 28
7
Join table not being populated
Hello,
I have the usual Categories and Products table scenario, mediated by a
Categories_Products join table. When I create a new Product and into a
given Category, I notice that my join table is not being populated.
Shouldn''t the join Categories_Products table be populated?
Thanks,
gk
--
Posted via http://www.ruby-forum.com/.
2009 Oct 12
15
We're sorry, but something went wrong on Tomcat
I am using JRuby and I have to deploy on Tomcat. My web app is working
fine in the dev envirmonment, with Mongel, but when I deploy on Tomcat
I get "We''re sorry, but something went wrong on Tomcat".
The problem is that production.log only shows:
# Logfile created on Mon Oct 12 12:54:36 +0100 2009-bash-3.00
The file permission and directory are 777.
Any idea how I can