On 14 April 2010 03:47, Cote <[email protected]> wrote:
>...
> Hi Team,
>
> I am having a similar problem, also following along from railscast 32.
>
> Any suggestions welcome. Is it an erb thing or something wrong with my
> model code? Also :formdate is a date field not a datetime field.
>
> ==========
> View throws this ERROR PAGE:
> ArgumentError in Contracts#new
>
> Showing app/views/contracts/new.html.erb where line #84 raised:
>
> wrong number of arguments (1 for 0)
>
> Extracted source (around line #84):
>
> 81: <td>
> 82: <div class="order_details">
> 83:
> 84: <div class="onecol"><%= f.label
> :formdate, "Date" %><br /><%=
> f.text_field :formdate_string
> 85: %></div>
> 86: <div class="twocol1"><%= f.label
> :publication %> <%=
> f.text_field :publication %></div>
> 87: <div class="twocol2"><%= f.label
> :issue %> <%=
> f.text_field :issue %></div>
This is not a similar problem at all. The OP had an issue with
validations, yours is showing an error.
I don't see the problem immediately, but I suggest removing bits of
code till it does not show the error, then putting it back a little at
a time till you find exactly what is causing the problem.
>
>
> Request
>
> Parameters:
>
> None
>
> Show session dump
>
> ---
>
> Response
>
> Headers:
>
> {"Content-Type"=>"text/html",
> "Cache-Control"=>"no-cache"}
> ==========
>
> MODEL:
> class Contract < ActiveRecord::Base
>
> def formdate_string
> formdate.to_s(:db)
> end
>
> def formdate_string=(fdate_str)
> self.formdate = Time.parse(fdate_str)
> end
>
> end
> ==========
>
> VIEW: new.html.erb - extract
> <div class="onecol"><%= f.label :formdate, "Date" %><br />
> <%= f.text_field :formdate_string %></
> div>
That does not appear to be exactly the same code as shown in the error
above. Above it has a newline after :formdate_string, as it shows the
%> on line 85. Could that be part of the problem I wonder?
Colin
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.