Displaying 20 results from an estimated 30000 matches similar to: "Rails 3, using helpers in controller"
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
2007 Jan 16
2
Using view helpers in migrations?
I''m writing a bloggish/CMSish thing. I had been using simple_format,
but my users requested a rich editor, so I added TinyMCE.
Anyway, I was trying to migrate the existing content (since TinyMCE
assumes it''s reading HTML-formatted text), and realized that I
couldn''t call simple_format (or other helper methods) from Migrations.
Can someone enlighten me here?
2006 Mar 01
0
TextHelpers in Controller?
I have a controller that saves info to the DB. It''s based on the AJAX
scaffolding code. All I want to do is add a simple_format() function to
it before I save a user-edited text field to the DB. TO convert line
returns to <br>s, etc.
@project_note = ProjectNote.new(params[:project_note])
@project_note.body = simple_format(@project_note.body)
Since this happens in a controller,
2006 Feb 09
0
Weird simple_format behavior
I''m working on a page combining Ajax.InPlaceEditor and the
simple_format helper. The page is demonstrating some very strage
behavior. First, here is the code:
<p>Bio: </p>
<div id="bio">
<% if @user.bio %>
<%= simple_format( @user.bio ) %>\
<% else %>
No Bio Yet
<% end %>
</div><em>(click on your to bio edit
2006 Oct 14
0
A not so simple simple_format helper
Hi, is there a not as simple simple_format helper in rails? :) I would
like to keep the line breaks from the input, however, I would like to
escape all other HTML elements. So basically it is the h() helper but
keeps the line breaks.
Any suggestions?
Thanks in advance.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this
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
2006 Jan 13
0
testing Helpers
[I''m reposting this. The subject wasnt complete and misleading in my
initial post (''testing'')]
I''m looking for a good way to make all of Rails'' inbuilt helpers
available to my custom Helper while I''m testing it.
The Helper I''m testing is EditorHelper. EditorHelper itself relies on
some of Rails'' inbuilt Helpers, such as
2006 Mar 15
4
RJS template eating encoding
I was previously doing an update via .rhtml templates creating an AJAX
:evaluate_remote_response. I use UTF-8 in my pages, and my app
requires that I be able to, say, put Japanese characters in.
The problem is that when I switched this over to an RJS template it
started eating the encoding. I now get garbage characters where before
I got the correct ones.
The code for the RHTML:
<%=
2006 Jan 04
2
simple_format and in_place_editor_field
Hi!
How can i do to force an in_place_editor_field to format the text with
simple_format while not editing?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060104/bbd141a2/attachment.html
2009 Mar 26
0
reverse of simple_format?
Hello!
Is there a way to reverse the TextHelper simple_format? I.e. to take
some text with <p> tags and <br> tags and convert them into line
breaks in a smart way? (smarter than just a regexp that is).
TIA!
-Danimal
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To
2006 Mar 30
2
How do I format text before saving it?
I tried to use a before_save and use simple_format, it returns and
undefined method error. Can I even use these methods within a model? I
tried to use auto_link and it failed too. What am I doing wrong?
Furthermore, would it be recommended I format text before saving it to
the database? Advantages or disadvantages?
--
Posted via http://www.ruby-forum.com/.
2008 May 29
4
ruby's simple_format method is not working for spaces.
Ruby''s simple_format method is not working for spaces. so how to add and
what to add in simple format method code so it also work for spaces?
--
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, send email to
2008 Jul 26
4
simple_format, (long) urls, and wrapping
I''m using simple_format to format and display posted content from
users. This content sometimes has urls in it.
The problem I''m having is that if the urls are long enough to wrap,
they do, but the url gets split with a <br> tag. Then, if the user
clicks on the link, only the first, non-wrapped part of the link gets
posted to the browser... and that''s an invalid
2008 Nov 12
0
guest inittab problems
We have several suse 10.3 guests running in paravirtualization, however
all the guests boot with the following messages:
Loading keymap Couldnt open /dev/tty1
Loading /usr/share/kbd/keymaps/i386/qwerty/us.map.gz
failed
Loading compose table latin1.add
failed
Start Unicode mode
Couldnt open /dev/tty1
Couldnt open /dev/tty2
Couldnt open /dev/tty3
Couldnt open /dev/tty4
Couldnt open
2006 Aug 29
4
/dev/tty*: not a character device after reboot
Hello All
I just recently adopted a server with Gentoo/Xen as domain0 server with several domainUs attached to it. Please forgive my xen-noobness, but I was hoping that someone can help me out.
These images have not been updated in a long time, and I''m trying to get all the domainUs updated with their appropriate services patches, etc. I''m currently working on one Gentoo
2006 Feb 27
4
Gettext and rails
Hi
Im using the newest GetText gem, and Im having problems with classes
outside rails, they don''t get translated. For example: I have a class
representing access in my app, and it is not a ActiveRecord, just a
normal class. When require ''gettext'' and include it in the class, I can
use the _('''') methods fine. They get picked upp by rake updatepo.
2007 Nov 02
2
Test that controller includes helpers?
Is there an easy way to spec that a controller should include helpers
other than its own? I was thinking I could just spec responds_to for
methods I''m interested in in the view, but that seems like crossing a
separation boundary, that the controller maybe doesn''t need to know about?
Thanks,
Steve
2010 Nov 17
3
How to use request helpers outside of controller specs?
I asked this questions on some other places before, but have found no
solution yet. I''d like to include the request helper (from
ActionDispatch::Integration::RequestHelpers, like post and xhr
methods) also in some specs outside of my controller specs. The
problem is that these request helpers are only included in spec/
controller and when a controller is described.
What do I have to
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 Aug 14
0
Automatic helpers for controller modules?
Just wondering, is there a way to automatically include helper modules
for controllers in modules? Something like (which doesn''t work, so I use
''helper :items):
app/controllers/admin/items_controller.rb
app/helpers/admin/items_helper.rb
Joe
--
Posted via http://www.ruby-forum.com/.