Syntax error

SyntaxError in Movie#new
compile error
D:/instant/rails_apps/videoondemand/app/views/movie/new.html.erb:8:
syntax error, unexpected ‘:’, expecting ‘)’
_erbout.concat(( collection_select(:movie,:genre_id,@genres:id,:name)
).to_s); _erbout.concat “

\n”
^
D:/instant/rails_apps/videoondemand/app/views/movie/new.html.erb:8:
syntax error, unexpected ‘)’, expecting tCOLON2 or ‘[’ or ‘.’
_erbout.concat(( collection_select(:movie,:genre_id,@genres:id,:name)
).to_s); _erbout.concat “\n”
^
Extracted source (around line #8):

5:

Price:
6: <%= text_field ‘movie’, ‘price’ %>


7:

Genre:
8: <%= collection_select(:movie,:genre_id,@genres:id,:name) %>


9:

Description

10: <%= text_area ‘movie’, ‘description’ %>


11: <%= submit_tag “Create” %>

Trace of template inclusion: /movie/new.html.erb

RAILS_ROOT: D:/instant/rails_apps/videoondemand
Application Trace | Framework Trace | Full Trace

app/views/movie/new.html.erb:15:in `compile_template’
D:/instant/ruby/bin/mongrel_rails:19

Request

Parameters:

None

heres my new.rhtm

Add new movie

<%= form_tag :action => 'create' %>

Title: <%= text_field 'movie', 'title' %>

Price: <%= text_field 'movie', 'price' %>

Genre: <%= collection_select(:movie,:genre_id,@genres:id,:name) %>

Description
<%= text_area 'movie', 'description' %>

<%= submit_tag "Create" %> <%= link_to 'Back', {:action => 'list'} %>

movie model
class Movie < ActiveRecord::Base
belongs_to :genre

end

genre model
class Genre < ActiveRecord::Base
has_many :movies
end

It would have been nice if you had asked a question, but anyways

_erbout.concat(( collection_select(:movie,:genre_id,@genres:id,:name)

I guess you meant @genres.id, not @genres:id

Greetz!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs