How to make form_tag/form_for work with rails 2.2.2 and hobo 0.8.5

7 views
Skip to first unread message

stevo84

unread,
Dec 17, 2008, 9:04:44 AM12/17/08
to Hobo Users
As in subject. When trying to use on of those helpers I receive:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.<<

Extracted source (around line #5):

2:
3: <column-mc:>
4:
5: <% form_for :user, :url => "/test/test" do |f| %>
6: <%= f.error_messages %>
7: <p>Please enter new password and confirmation.</p>
8: <fieldset style="width: 400px; margin-bottom: 25px;">

Trace:

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/
helpers/text_helper.rb:42:in `concat'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/
helpers/form_helper.rb:252:in `form_for'
app/views/test/index.dryml:5:in `render_page'
vendor/plugins/lbuilder/lib/dryml/template_environment.rb:259:in
`new_context'
app/views/test/index.dryml:3:in `render_page'
vendor/plugins/lbuilder/lib/dryml/template_environment.rb:515:in
`call'
...

Micah

unread,
Dec 19, 2008, 4:48:43 PM12/19/08
to Hobo Users
I ran into the same problem. It looks like the Hobo DRYML tag takes
over the standard Rails form helpers. I ended up just using the DRYML
form tag, as it comes with a bunch of implicit context automagic fun.
It would be nice to be able to use the standard Rails form helpers
though. Especially when converting an existing app to Hobo.

stevo84

unread,
Dec 20, 2008, 7:19:56 AM12/20/08
to Hobo Users
http://pastie.org/343841

Place this piece of code somewhere where it would override default
classes and it will enable you to use at least form_for and form_tag.
I do not claim that this is perfect solution but it works. Still I am
waiting for something "more official".

roland oth

unread,
Dec 21, 2008, 2:35:11 AM12/21/08
to hobo...@googlegroups.com
Hello stevo

Can you give a hint what a good file would be to past this in?

thanx

stevo84

unread,
Dec 21, 2008, 8:17:34 AM12/21/08
to Hobo Users
You can try making any *.rb file in config/initializers (these file
are autoloaded when starting server).
Yo can make any *.rb file in lib directory and require it within
environment.rb
You can also make a plugin in which you will have only init.rb with
"require 'xxx'" inside and lib directory with xxx.rb (and code
inside).

In my solution I have a separate plugin in which I've extracted DRYML
part of hobo and have those overrides loaded AFTER hobo dryml libs.
Reply all
Reply to author
Forward
0 new messages