1

I get this code generated for scaffold:

assert_difference('Day.count') do
  post :create, day: @day.attributes
end

you see? It's not :day => @day.attributes, it's day: @day.attributes. One of my two dev environments doesn't complain, another one complains, and production doesn't complain. Am I going crazy?

3 Answers 3

2

I expect one of your environments is using Ruby 1.9.2, and one environment is on an older version of Ruby.

What you're seeing is a form of named parameters (sometimes known as "keyword parameters") that provides syntactic sugar around the older hash mechanism that almost provided named parameters.

Sign up to request clarification or add additional context in comments.

Comments

0

That's just new ruby 1.9 syntax. You can track ruby syntax changes at eigenclass.org :-)

EDIT: Which seems to be malformed somehow. Interesting.

Comments

0

That's the newer ruby 1.9 hash syntax. Personally, I never made the switch. The good old arrows are fine with me. One of your environments apparently doesn't support it.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.