简体   繁体   中英

wrong number of arguments (2 for 1) RoR error

I am trying to make a simple app, and on my index page, I am running into the error:

wrong number of arguments (2 for 1)

The view looks like so (index.html.slim):

- provide(:title, 'All users')
h1
  | All users
ul.users
  - @users.each do |user|
    li
      = gravatar_for user, size: 50
      = link_to user.name, user

The error is pointing to the line:

= gravatar_for user, size: 50

Any idea why I am getting this error? Thank you in advance.

The options for gravatar_for should be in an options hash:

gravatar_for(user, options = { size: 50 }) ⇒ Object

See this .

You need

= gravatar_for user

See also Wrong number of arguments?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM