Forum: Ruby on Rails form_tag error (model)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
421f0a0ddf91f441710930ae777923eb?d=identicon&s=25 Roberto Casadei (robyonrails)
on 2007-04-30 13:24
That's give me an error

:: <%= form "user" %>
::     <%= input "user", "username" %>
:: <%= end_form_tag %>

 NoMethodError in Home#index
 Showing app/views/components/_loginbox.rhtml where line #1 raised:

You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.new_record?

Note that the directory /components/ doesn't match a controller (but it
isn't important).

Why?
833bc92fe8f46a9bfebae5afb65f7507?d=identicon&s=25 Swanand Deodhar (swanand)
on 2007-04-30 13:35
(Received via mailing list)
Hi!
   Unless i am missing something, there is no helper method just 'form'
you
might use form_for or form_tag. (start_form_tag is deprecated from Rails
1.2.1)
For full list please refer
  http://api.rubyonrails.com/classes/ActionView/Help...
Thanks and regards,
Swanand.
421f0a0ddf91f441710930ae777923eb?d=identicon&s=25 Roberto Casadei (robyonrails)
on 2007-04-30 13:43
Swanand Deodhar wrote:
> Hi!
>    Unless i am missing something, there is no helper method just 'form'
> you
> might use form_for or form_tag. (start_form_tag is deprecated from Rails
> 1.2.1)
> For full list please refer
>   http://api.rubyonrails.com/classes/ActionView/Help...
> Thanks and regards,
> Swanand.

Sorry, I changed it in order to try to resolve the error.

Actually, the error is:

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

And match the row:
<%= input "user", "username" %>
833bc92fe8f46a9bfebae5afb65f7507?d=identicon&s=25 Swanand Deodhar (swanand)
on 2007-04-30 13:54
(Received via mailing list)
Hi!
       As you are trying have an rhtml page with a textfield
corresponding
to a username column of users table.
  You might wanna try <%= text_field :user, :username%>.
  I am not too sure what is <%= input%>
Thanks and regards,
Swanand
421f0a0ddf91f441710930ae777923eb?d=identicon&s=25 Roberto Casadei (robyonrails)
on 2007-04-30 13:59
Swanand Deodhar wrote:
> Hi!
>        As you are trying have an rhtml page with a textfield
> corresponding
> to a username column of users table.
>   You might wanna try <%= text_field :user, :username%>.
>   I am not too sure what is <%= input%>
> Thanks and regards,
> Swanand


MMmmh it doesn't work.

input =>
http://api.rubyonrails.org/classes/ActionView/Help...
This topic is locked and can not be replied to.