Displaying 20 results from an estimated 5000 matches similar to: "Maintaining a selection list"
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/.
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 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 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
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 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/.
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 Jan 07
10
RMagick bus error on OS X in console mode
This is a strange bug that I''ve never seen before. It only shows up
when I run the app through the console (the app is Family Connection,
and it works fine when run as a web app):
22$ ruby script/console
Loading development environment.
>> User
/opt/local/lib/ruby/vendor_ruby/1.8/powerpc-darwin8.3.0/
RMagick.bundle: [BUG] Bus Error
ruby 1.8.2 (2004-12-25)
2014 Aug 07
2
[PATCH] lua: always return luaL_error in actions
Even if luaL_error is a "no return" function for the Lua runtime, adopt
also in action functions the "return" idiom recommeded for it.
This also helps code analyzers in not thinking that "g" might still be
null after the null check followed by luaL_error.
---
generator/lua.ml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/generator/lua.ml
2006 Mar 03
2
Accessing cookie and session objects
Is it possible to directly access session and cookie objects from within
a Model? When I try to read the session object in my User Model I get
the following error:
NameError (undefined local variable or method `session'' for User:Class):
I could pass attributes taken from the session into my method in the
User Model, but this seems to go against DRY.
-Lindsay
--
Posted via
2006 Feb 15
2
First unit test fails
I''ve just started working through ''Agile'' chapter 12
''Testing''. I''ve followed the steps carefully, setting up a fixture and
unit test to check the creation of an order. When I run the test I get
the following:
Loaded suite test/unit/order_test
Started
F
Finished in 0.108008 seconds.
1) Failure:
test_create(OrderTest)
2006 May 04
1
How do I identify the initiating View from within a Helper?
I would like to call a helper method from my View to construct a sidebar
menu. The menu is contextual, so ideally I would like to do something
like this:
View
----
<%= sidebar_menu %>
Helper
------
def sidebar_menu
case _calling_view_
when ''_view_identifier_''
... build menu...
end
end
where ''_calling_view_'' is the key that points to the
2006 May 22
1
Agile Web Dev unit test fails with fixture instance variable
I''m following Agile Edition 1. On page 148 it suggests using instance
variables named after the fixture, for example:
assert_equal @version_control_book.id, @product.id
When I introduce this type of instance variable into my test, I get the
following error:
1) Error:
test_not_owner(GroupTest):
RuntimeError: Called id for nil, which would mistakenly be 4 -- if you
really wanted the
2006 Mar 27
3
RMagick and thumbnails
I''ve based my code on the Agile example for uploading files, pages
362-365. I''ve successfully loaded the Picture object to the database,
but I come unstuck when trying to replicate this for a thumbnail version
of the original image:
thumbnail = Thumbnail.new
thumbnail.name = ''thumbnail_'' + @picture.name.to_s