我的语法错误在哪里?

时间:2011-05-20 04:42:13

标签: ruby-on-rails ruby ruby-on-rails-3 syntax

SyntaxError in Videos#show

Showing /rubyprograms/dreamstill/app/views/videos/show.html.erb where line #54 raised:

compile error
/Library/Ruby/Gems/1.8/gems/activemodel-3.0.4/lib/active_model/attribute_methods.rb:272: syntax error, unexpected ')'
/Library/Ruby/Gems/1.8/gems/activemodel-3.0.4/lib/active_model/attribute_methods.rb:273: syntax error, unexpected '?', expecting $end
Extracted source (around line #54):

51:         <%= link_to "Show Song", '#', :id => 'video_show_link', :class => 'edit' %>
52:     
53:         <div id="showable_video_div">
54:             <%= form_for [@video, @video.showable_videos.new ], :url => showable_videos_path, :remote => true do |f| %>
55:                 <%= f.hidden_field :video_id, :value => @video.id, :id => "video_id_field" %>
56:                 <%= f.text_field :user, :class => "showable_field" %>
57:             <% end %>

这是我在抛出错误之前所做的showable_videos表的迁移:

class AddUpvotedAndSeenToShowableVideos < ActiveRecord::Migration
  def self.up
    add_column :showable_videos, :upvoted?, :boolean
    add_column :showable_videos, :seen?, :boolean
  end

  def self.down
    remove_column :showable_videos, :seen?
   remove_column :showable_videos, :upvoted?
  end
end

1 个答案:

答案 0 :(得分:1)

我刚刚撤消上面的迁移,然后在列名称中没有?的情况下再次运行迁移。我不再收到语法错误。