Re: ArgumentError in Controller#new after updating Rails version

68 views
Skip to first unread message

cooke...@gmail.com

unread,
May 27, 2013, 2:04:36 AM5/27/13
to rubyonra...@googlegroups.com
I think you should check your routes.rb file.  
kang

On Sunday, May 26, 2013 8:49:27 PM UTC+8, Sasha Chilly wrote:
Hello, need some help,
App is running under Ruby 1.8.7 and Rails 3.0.11
After updating Rails version to 3.1.11, tsrted to fet strange error on new article page:


Don't know where this error could come from, as in controller i have only:

 class ArticlesController < ApplicationController

  def new
    @article = Article.new
  end

and in view is only form_for @article.

However edit action works fine, as before Rails update.

Any ideas how to fix it?

Colin Law

unread,
May 27, 2013, 4:52:04 AM5/27/13
to rubyonra...@googlegroups.com
On 26 May 2013 13:49, Sasha Chilly <sashac...@gmail.com> wrote:
> Hello, need some help,
> App is running under Ruby 1.8.7 and Rails 3.0.11
> After updating Rails version to 3.1.11, tsrted to fet strange error on new
> article page:
>
> http://cl.ly/image/1o0P050d2q41

You should get a more detailed trace in the server console or in development.log

Colin

>
> Don't know where this error could come from, as in controller i have only:
>
> class ArticlesController < ApplicationController
>
> def new
> @article = Article.new
> end
>
> and in view is only form_for @article.
>
> However edit action works fine, as before Rails update.
>
> Any ideas how to fix it?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/40514bb7-bb1a-4b40-9a32-590ba89e36bd%40googlegroups.com?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Sasha Chilly

unread,
May 27, 2013, 6:05:08 AM5/27/13
to rubyonra...@googlegroups.com, cla...@googlemail.com
This is what i can see in development.log file:

Started GET "/articles/new" for 127.0.0.1 at Mon May 27 14:00:44 +0400 2013
  Processing by ArticlesController#new as HTML
Completed 500 Internal Server Error in 214ms

ArgumentError (wrong number of arguments (1 for 0)):
  

Rendered /Users/iriskin/.rvm/gems/ree-1.8.7-2012.02@mednadom/gems/actionpack-3.1.11/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.1ms)
Rendered /Users/iriskin/.rvm/gems/ree-1.8.7-2012.02@mednadom/gems/actionpack-3.1.11/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.7ms)
Rendered /Users/iriskin/.rvm/gems/ree-1.8.7-2012.02@mednadom/gems/actionpack-3.1.11/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (6.1ms)

As for me, unfortunately, not very helpful(

понедельник, 27 мая 2013 г., 12:52:04 UTC+4 пользователь Colin Law написал:

and...@benjamin.dk

unread,
May 31, 2013, 4:55:22 AM5/31/13
to rubyonra...@googlegroups.com


On Sunday, 26 May 2013 14:49:27 UTC+2, Sasha Chilly wrote:
Hello, need some help,
App is running under Ruby 1.8.7 and Rails 3.0.11
After updating Rails version to 3.1.11, tsrted to fet strange error on new article page:


and...@benjamin.dk

unread,
May 31, 2013, 4:57:13 AM5/31/13
to rubyonra...@googlegroups.com, cla...@googlemail.com


On Monday, 27 May 2013 12:05:08 UTC+2, Sasha Chilly wrote:
This is what i can see in development.log file:

Started GET "/articles/new" for 127.0.0.1 at Mon May 27 14:00:44 +0400 2013
  Processing by ArticlesController#new as HTML
Completed 500 Internal Server Error in 214ms

ArgumentError (wrong number of arguments (1 for 0)):
  

Sorry if I will reapeat myself but I am sure the first post did what I wanted:

This error means you are calling a function with 1 argument that receives 0.

can you show us your complete view?

Sasha Chilly

unread,
May 31, 2013, 6:54:48 AM5/31/13
to rubyonra...@googlegroups.com, cla...@googlemail.com
Here it is:

<% set_editor_comment %>
<%= form_for @article do |f| %>
  <%= render "shared/error_messages", :target => @article %>
  <% if admin? %>
    <p>
      <%= f.label :user_id %>
      <%= f.select :user_id,  User.authors_and_admins.collect {|p| [ p.username, p.id ] } %>
    </p>
  <% end %>
  <p>
    <%= f.label :category_id %><%= mark_required(@article, :category_id) %><br/>
    <%= f.select :category_id,  Category.all.collect {|p| [ p.name, p.id ] }, { :include_blank => true } %>
  </p>
  <p>
    <%= f.label :name %><%= mark_required(@article, :name) %><br/>
    <%= f.text_field :name %>
  </p>
  <p>
    <%= f.label :preview %><%= mark_required(@article, :preview) %><br/>
    <%= f.text_area :preview, :size => "70x6" %>
  </p>
  <p>
    <%= f.label :body %><%= mark_required(@article, :body) %><br/>
    <%= f.text_area :body, :class => "mceEditor", :size => "100x20" %>
  </p>
  <% if admin? %>
    <p>
      <%= f.label :publish_on_main %>
      <%= f.check_box :publish_on_main %>
    </p>
  <% end %>
  <%= f.submit %>
<% end %>

<div style="margin-top: 10px;">
  <iframe src="<%= images_path %>" width="90%" height="500" name="imagesIframe"></iframe>
</div>

and...@benjamin.dk

unread,
May 31, 2013, 7:58:23 AM5/31/13
to rubyonra...@googlegroups.com, cla...@googlemail.com
And the server console does not give you any information?

when you hit the route what does the browser show?

Sasha Chilly

unread,
May 31, 2013, 8:06:03 AM5/31/13
to rubyonra...@googlegroups.com, cla...@googlemail.com
What browser shows - i've linked in my first post.
What is shown in console - you can see in my second post.
That's all information that i can see..

пятница, 31 мая 2013 г., 15:58:23 UTC+4 пользователь and...@benjamin.dk написал:

and...@benjamin.dk

unread,
May 31, 2013, 8:27:33 AM5/31/13
to rubyonra...@googlegroups.com, cla...@googlemail.com
Well in your second post you do not show the development.log, what I am asking is your console where you start your server.

also have you tried and raised your view to see if it gets hit.
like on line 1:

<%= raise "puts".inspect %>

if it doesnst raise we will know the view does not get hit and we try the controller then put the raise on the beginning if doesnt get hit then we know its on the routes or rails. try that as well
Reply all
Reply to author
Forward
0 new messages