실용적인 프로그래머의 'Rile with Agile Web Development'에서 Ruby on Rails를 배우기 시작했습니다. ruby on ruby
나는 작은 응용 프로그램을 작성하고 실행시 나는 그것을 실행할 때 나는 다음과 같은 구문 오류가 나타날 수 이/Users/colinlabri/Desktop/depot/app/models/product.rb:2: syntax error, unexpected ':', expecting keyword_end
attr_accessible : title, :description, :image_url, :price
^
/Users/colinlabri/Desktop/depot/app/models/product.rb:2: syntax error, unexpected ',', expecting tCOLON2 or '[' or '.'
attr_accessible : title, :description, :image_url, :price
^
Rails.root: /Users/colinlabri/Desktop/depot
Application Trace | Framework Trace | Full Trace
app/controllers/products_controller.rb:1:in `<top (required)>'
이 다음에 DB의 코드가 될 때 :
class CreateProducts < ActiveRecord::Migration
def change
create_table :products do |t|
t.string : title
t.text :description
t.string :image_url
t.decimal :price, precision: 8, scale: 2
t.timestamps
end
end
end
버전이를 다음과 같이 : ruby 1.9.3p362 레일 3.2.11
sqlite 설치를 확인해야합니까?
t.string : title
에 :
이t.string :title
귀하의 모델은 또한 attr_accessible
전화에서 같은 문제가
attr_accessible :title
에, 나는 그것을 알았어 야! 위의 내용을 변경하고 파일을 저장했습니다. '제품'테이블을 찾을 수 없습니다. – user1900791마이그레이션이 실행되지 않았거나 이전에 실행하지 않았을 가능성이 큽니다. 터미널에서'rake db : migrate'를 시도해보십시오. –