newbie: what am I doing wrong? (syntax error)

Hi to all,

I am currently learning Ruby on Rails, and I am learning from videos from lynda.com "Ruby on Rails 3 Essential Training". However, I have some problems when I want to assign values to my object. I copy pasted like it is on video, but I got syntax error:

Loading development environment (Rails 3.0.10) ruby-1.9.2-p290 :001 > second_page = Page.new ( :name=>"Second page", :position=>1, :permalink => "second" ) SyntaxError: (irb):1: syntax error, unexpected tASSOC, expecting ')' ...econd_page = Page.new ( :name=>"Second page", :position=>1, ... ... ^ (irb):1: syntax error, unexpected ',', expecting $end ...age.new ( :name=>"Second page", :position=>1, :permalink => ... ... ^         from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/ lib/rails/commands/console.rb:44:in `start'         from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/ lib/rails/commands/console.rb:8:in `start'         from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/ lib/rails/commands.rb:23:in `<top (required)>'         from script/rails:6:in `require'         from script/rails:6:in `<main>'

but if I remove () then it is ok:

ruby-1.9.2-p290 :002 > second_page = Page.new :name=>"Second page", :position=>1, :permalink => "second" => #<Page id: nil, subject_id: nil, name: "Second page", permalink: "second", position: 1, visible: false, created_at: nil, updated_at:

ruby-1.9.2-p290 :003 >

I am wondering what is going here, what is the correct version? Did something changed with versions? Thank you

Hi to all,

I am currently learning Ruby on Rails, and I am learning from videos from lynda.com "Ruby on Rails 3 Essential Training". However, I have some problems when I want to assign values to my object. I copy pasted like it is on video, but I got syntax error:

Loading development environment (Rails 3.0.10) ruby-1.9.2-p290 :001 > second_page = Page.new ( :name=>"Second

Don't put a space between the method name (new) and the (

Fred

Don't put a space between the method name (new) and the (

Fred

thank you... that did the trick...:slight_smile: