I have been following this tutorial, http://ruby.railstutorial.org/chapters/modeling-users?version=3.2#top,
and I tried this in the rails console
User.new(name: "Michael Hartl", email: "mhart@example.com")
SyntaxError: compile error
but when I tried this it worked:
User.new(:name=> "Michael Hartl", :email=>"mhart@example.com")
=> #<User id: nil, name: "Michael Hartl", email: "mhart@example.com", created_at: nil, updated_at: nil>
I am using rails 3.2.1, which I guess this is the problem, but why change the syntax to something more complicated like, :<variable>=> instead of <variable>: ??
You didn’t type it correctly.
User.new(name: "Michael Hartl", email: "mhart@example.com")