2009-09-18 4 views
0

저는 BitNami RubyStack에서 Ruby on 2.3.2로 코딩하고 있습니다. 내가 업로드 컨트롤러를 호출 할 때,이 같은 오류가 발생합니다 :Ruby on Rails에서보기를 컴파일하는 동안 오류가 발생 했습니까?

compile error 
C:/Users/BitNami RubyStack/killerapp/app/views/upload/index.html.erb:6: 
unterminated string meets end of file 
C:/Users/BitNami RubyStack/killerapp/app/views/upload/index.html.erb:6: 
syntax error, unexpected $end, expecting ')' 

인덱스 뷰의 코드 :

<% form_for :picture, :html => { :multipart => true } do |form| %> 
<label for="first_name">First_Name:</label> 
<%= form.text_field :first_name %> 
<label for="last_name">Last_Name:</label> 
<%= form.text_field :last_name %> 
<%= submit_tag "upload" %> 
<% end %> 

문자열 숫자 6은 다음과 같습니다

<%= submit_tag "Upload" %> 

문제는 무엇입니까? 도와주세요.

+0

더 나은 형식으로 질문을 수정하시기 바랍니다 인스턴스를 설정해야합니다 d는 뷰 라인 (6)의 어느 라인을 가리킨다. –

+1

form.submit_tag이 아니어야합니까? – SeanJA

+0

번호. 도움이되지 않았다. –

답변

0

<% form_for :picture, :html => { :multipart => true } do |form| %> 
<%= label :picture, :first_name, "First Name" %> 
<%= form.text_field :first_name %> 
<%= label :picture, :last_name, "Last Name" %> 
<%= form.text_field :last_name %> 
<%= form.submit "upload" %> 
<% end %> 

을 시도하고 그것은 레일 2.3.4에서 나를 위해 작동

# routes.rb 
map.resources :pictures 
+0

Lichtamberg 아, 이제 내가 정의되지 않은 메서드'picture_path 받고 있어요 '#에 대한 u는 내가 정의되지 않은 메서드'병합 얻을 을 wrtten 한 새로운 코드에 대한 –

+0

' "이름"에 대한을 : 문자열 –

+0

routes.rb에 그림 컨트롤러가 있습니까? – Lichtamberg

0
ActionController::Routing::Routes.draw do |map| 
    # The priority is based upon order of creation: first created -> highest priority. 

    # Sample of regular route: 
    # map.connect 'products/:id', :controller => 'catalog', :action => 'view' 
    # Keep in mind you can assign values other than :controller and :action 

    # Sample of named route: 
    # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' 
    # This route can be invoked with purchase_url(:id => product.id) 

    # Sample resource route (maps HTTP verbs to controller actions automatically): 
    # map.resources :products 

    # Sample resource route with options: 
    # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get } 

    # Sample resource route with sub-resources: 
    # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller 

    # Sample resource route with more complex sub-resources 
    # map.resources :products do |products| 
    #  products.resources :comments 
    #  products.resources :sales, :collection => { :recent => :get } 
    # end 

    # Sample resource route within a namespace: 
    # map.namespace :admin do |admin| 
    #  # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb) 
    #  admin.resources :products 
    # end 

    # You can have the root of your site routed with map.root -- just remember to delete public/index.html. 
    map.root :controller => "pictures" 

    # See how all your routes lay out with "rake routes" 

    # Install the default routes as the lowest priority. 
    # Note: These default routes make all actions in every controller accessible via GET requests. You should 
    # consider removing the them or commenting them out if you're using named routes and resources. 
    map.connect ':controller/:action/:id' 
    map.connect ':controller/:action/:id.:format' 
end 
0

를 추가합니다. 디버깅을 시도 했습니까?

+0

JRL 아니요. 어떤 버전의 Ruby를 사용하나요? 리눅스에서 일하고 있습니까? –

0

당신이 당신의 form_for이 그것의 더 나은 아이디어도 map.resources :pictures

가 있어야 내가 넷빈즈를 사용하고, 그리고 그것은 나를 라인 (6)에 breakbpoint을 설정할 수 및 실행 등 다양한 변수를 검사합니다 클래스

<% form_for @picture, :html => {:multipart = true} do |form| %> 

의 인스턴스를 가리킨 다음 컨트롤러에서 당신이

@picture = Picture.new 
관련 문제