Displaying 20 results from an estimated 4000 matches similar to: "Is there a link_to ''external url''?"
2006 May 08
3
Can you have multiple before filters?
Hi,
Is it possible to specify multiple before filters in a controller...
here''s the thing: only one set of filters is to use the :except option.
Something like:
before_filter :check_for_session_cookie
before_filter :validate_user :except =>[''login'']
which I use to a) check if the user has returned to the site and has a
saved cookie holding login details b) check
2006 Apr 06
10
Advice needed on tracking down unusual error
Does anyone have advice on how to go about locating the cause of this
error message:
ActionView::TemplateError (wrong number of arguments (3 for 1)) on line
#4 of app/views/products/search.rhtml:
4: <%= start_form_tag :action => ''search'' %>
I don''t see anything wrong with line 4 above.
Some background: I''ve made a number of changes to Controllers,
2006 May 02
5
does not equal conditional
I am trying to figure out how to write a conditional statement that will
execute only if a specified variable is not empty.
Right now my view looks like this:
<dt>Building Regulations</dt>
<% for link in @cat1 %>
<dd><a href="<%= link.url %>"><%= link.title %></a></dd>
<% end %>
Action:
@cat1 = Link.find(:all, :conditions
2006 Apr 29
5
HABTM - how to insert join row when associated rows exist
I have successfully used HABTM to create a many-to-one-to-many set of
rows in one step. Now, if two objects I want to associate already exist,
how do I create the join row? The Agile book mentions the
''push_with_attributes'' method. The text says this method is useful for
adding additional attributes to the join row (in the example a ''read_at''
timestamp). I
2006 Apr 20
2
Is there a problem with Agile code in Web 2.0 chapter?
Hi, I''m running the code example for ''Dynamically Updating a List'' in
Agile pages 404-406:
When I enter a new to-do, and click ''New Item'', a new page is rendered
only displaying the new to-do just entered. This isn''t what''s expected.
The to-do list with id="items" should be updated so the to-do list
dynamically grows.
2006 Feb 24
2
Double Render Error
Is there a way to suppress the Double Render Error:
"ActionController::DoubleRenderError.
Render and/or redirect were called multiple times in this action. Please
note that you may only call render OR redirect, and only once per
action."
Ideally, I would like the last redirect/render called to be the one that
is actually used when the page is sent to the browser.
--
Posted via
2006 Feb 20
4
SHow do you suppress ERB newlines globally
Is there a config flag to suppress the newline at the end of every ERB
''%>'' tag, so it would not be necessary to type ''-%> each time?
--
Posted via http://www.ruby-forum.com/.
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 May 11
3
Textile/RedCloth and h() incompatible?
If a user enters the Textile-based code for an image, say:
!>graphic.png!
the textile() method will successfully render a right-float image. Now,
if I want to escape the user''s text using h(), the ''>'' is turned into an
&. Obviously, the image then fails to render in a browser. Is there
a work around for this?
I guess what I''m really asking
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.
2006 Jun 04
5
Embedding link_to''s within text fetched from database.
Hi,
I have the following problem that I can''t seem to figure out. I want to
able to fetch some text from my database record in my controller, and then
add two links within the text and then send that back to the view to get
rendered so that the two links appear as links and when clicked on, they''d
basically call the corresponding action for the link. Would anybody know
how to
2006 Feb 22
3
Unit test failure - nil object?
I''m following instructions in the Agile book, page 146 for testing an
object update to the database. Here''s my code:
def test_update
assert_equal "jack@smiths.com", @user.email
@user.email = "jack@smiths.org"
assert @user.save, @user.errors.full_messages.join("; ")
@user.reload
assert_equal @user.email,
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 21
4
Can RoR''s AJAX helpers do this?
Hi,
I want to type text into an input field then on enter, use AJAX to
update the value of an input field elsewhere on the screen.
''observe_field'' allows me to watch a form field and dynamically update a
DIV. Is there a variation or other method to allow me to update a field
instead?
--
Posted via http://www.ruby-forum.com/.
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
2006 Feb 10
2
file column within link_to
Hi,
I correctly see:
image_tag url_for_file_column("element", "picture_url", "medium")
now I need to make it a link so I''ve used:
<%= link_to(image_tag url_for_file_column("element", "picture_url",
"medium"), {:controller => "products", :action => "sec_level",
:level_id => @element.id}) unless
2006 Jun 21
3
Is this a weird bug with auto_complete?
I think I may have found a bug with the auto_complete feature in rails:
My controller has a before_filter with an except clause preventing the
filter from running on a specific action. The action renders a view with
a text_field_with_auto_complete field. Much to my suprise, the filter
appears to run when I type data into this field! The filter is part of
my security regime, so I end up with a
2006 Mar 25
3
validates_presence_of validation order?
I have a form with 3 fields: user_id, email and password.
All 3 fields are required, so I have a "validates_presence_of :user_id,
:email, :password" in my model.
Works, but the validation errors show up in a different order than I
specificed in the validates_presence_of statement.
Is there a way to specify the order in which the validations (and
corresponding error messages) should
2007 Feb 06
3
Form won't accept ampersand
Hi guys,
My start_form_tag generated form will not accept a text field containing
an ampersand.
For example, the text ''A & B'' is trunacted to ''A'' in the param hash.
I know ampersands have to be encoded in URLs, but I''m surprised my form
has a problem with this. I''ve tested this in Safari and Firefox.
thanks
Lindsay
--
Posted via
2006 Apr 16
4
Preventing crawlers on link_to''s
My understanding was that using the :post=>true on a link_to() was supposed
to prevent search engine crawlers from triggering the link. However, this
does not seem to be working for me. Is there something else that I should
be/can be doing to accomplish this? Thanks.
-Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: