Displaying 20 results from an estimated 6000 matches similar to: "Simple: How to use TextHelper in a controller"
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 May 30
7
Stripping HTML tags from a string
Hello,
Is there a common way of stripping html tags from a string? Right now I''m
just calling gsub!(/<.*?>/, ''''), but with a background in PHP and always
having used its strip_tags() method, I wonder if the Rails community has
standardized this fairly common task with something a bit less simpleminded
than my quick fix.
Thanks!
Zack
-------------- next part
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
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 May 03
1
Ruby based HTML - to - text converter?
All,
I am interested in trying to generate a text version of an HTML
document.
Does any one know of any modules that may be of use to me?
A cursory search has not yielded any results.
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
2009 Sep 14
0
markdown call prompts "uninitialized constant ActionView::Helpers::TextHelper::Markdown" in upgraded application
Hey All,
I''m attempting to upgrade my app from rails 2.0.2 to 2.3.3. One bit that''s failing is this call here (in /views/projects/show.html.erb)
<%= markdown(@project.description) %>
That earns me a:
uninitialized constant ActionView::Helpers::TextHelper::Markdown
On that line.
I''m on a rebuilt machine (windows xp, ruby 1.8.6) so I thought it was a
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
2011 Apr 19
1
RSpec/Webrat Checking output is properly escaped
I want to test that the JSON response from a create action is
sanitized properly, but rspec or webrat appears to be parsing the
output into proper HTML chars instead of escaped characters. I have
verified that it escapes properly in the regular browser json
response.
The relevant RSpec test code is:
include ActionView::Helpers::TextHelper
include ActionView::Helpers::UrlHelper
it
2006 Jul 05
3
PLUGIN newbie: How do I use an installed plugin
All,
I''ve downloaded and installed a plugin into my vendor directory. How do
I then take advantage of it?
It has an init.rb file which has the appropriate require.
What do I need to do to make sure that the plugin code gets loaded?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
2010 Sep 23
1
Patch to fix docs for auto_link
Hi I''ve contributed a patch which fixes an incorrect example in the
documentation for auto_link in ActionView::Helpers::TextHelper.
The example uses truncate in the old style of tuncate(text, length)
which no longer works, so I''ve patched it to use the new
tuncate(text, :length => n) style.
2007 Jan 04
2
remove html tags from string in controller, how?
Been searching for a function that can do this, but have onl found a
helper function.
is there a way to strip all html tags of a string in a controller?
Thanks
--
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 post to this group,
2006 Jul 03
4
text_field doesn''t call overridden ActiveRecord getters
All,
In a template, I have
<%= text_field :target_list, :DateReceived,
{ :title => ''uploaded_at'',
:class =>
''target_list_info'',
:disabled => ''true'' } %>
Here is the DateReceived method on my
2009 Feb 24
2
Displaying line breaks & paragraphs using 'simple_format' ?
Hi there,
I need to:
1. STORE a text of the below format in a (MySQL) database (using a
''textarea''), and then
2. RETRIEVE & DISPLAY it in exactly the same format (meaning: keeping
all paragraphs/line breaks).
The intended text format looks like this:
***
Blah blahblah blah blah blahblah blah blah
blahblah blah blah blahblah blah, blah
blahblah. <- NEW
2005 Dec 28
0
Modifying VERBOTEN_TAGS in TextHelper
Hello all,
I''m using the sanitize() method from TextHelper in my application, which
appears to use the VERBOTEN_TAGS constant to define which tags to escape
out from the HTML. I''d like to modify VERBOTEN_TAGS to include some more
tags, but I''m not sure where I would place the necessary code in my
rails app. Any ideas?
Thanks,
Kamil
--
Posted via
2006 Jan 04
5
help with link_to_if, I can''t make it work...
For the life of me I can''t get it to work. Here is an example of my
syntax. I''m trying to make comment.name a link to comment.web_site only
if there is a comment.web_site. Can someone please help?
<%= link_to_if(comment.web_site.length > 0, comment.name,
comment.web_site {"class" => "comment_by"}) %>
--
Posted via
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 Feb 20
2
Alternating Table Row Colors
Does Rails have built in support for alternating table row colors?
Thanks,
Sam
2006 Jul 17
6
Best Practices: Splitting the "view model" from AR model
All,
I''m starting to see view state information creeping into my model class.
For example, I have text fields in my view that need to be set a certain
way depending on whether or not a checkbox is checked. And while the
values of these text fields ultimately do represent database columns
that are related to the backing AR object, the text_field values also
represent attributes on a