Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 3 语法错误,但语法正确吗?意外的';:';,应为';)';_Ruby On Rails 3_Nested Forms - Fatal编程技术网

Ruby on rails 3 语法错误,但语法正确吗?意外的';:';,应为';)';

Ruby on rails 3 语法错误,但语法正确吗?意外的';:';,应为';)';,ruby-on-rails-3,nested-forms,Ruby On Rails 3,Nested Forms,我有一个嵌套表单(见下文) 模特艺术家(艺术家是用户) 控制器艺术作品 def new @artist = Artist.find(params[:artist_id]) @artwork = @artist.art_works.build respond_to do |format| format.html # new.html.erb format.json { render json: @artwork }

我有一个嵌套表单(见下文)

模特艺术家(艺术家是用户)

控制器艺术作品

    def new
    @artist = Artist.find(params[:artist_id])
    @artwork = @artist.art_works.build
    respond_to do |format|
          format.html # new.html.erb
          format.json { render json: @artwork }
        end
      end
  def create
    @artwork = ArtWork.new(params[:artwork])
    respond_to do |format|
      if @artwork.save
        format.html { redirect_to @artwork, notice: 'artwork was successfully created.' }
        format.json { render json: @artwork, status: :created, location: @artwork }
      else
        format.html { render action: "new" }
        format.json { render json: @artwork.errors, status: :unprocessable_entity }
      end
    end
  end
艺术品视图(表格)

<%= form_for(@artwork, :url => artist_art_works_path(current_artist) :multipart => true) do |f| %>
<p>
    <%= f.file_field :art %>
</p>
<p>
    <%= f.submit %>
</p>
<% end %>

事先非常感谢您的帮助。(很抱歉没有告诉你)

你漏掉了一个逗号。是的,错误信息没有那么大帮助

@artwork, :url => artist_art_works_path(current_artist) :multipart => true
vs


天哪,非常感谢你,我一整天都在盯着这个
artist_art_works GET    /artists/:artist_id/art_works(.:format)                          art_works#index
                              POST   /artists/:artist_id/art_works(.:format)                          art_works#create
          new_artist_art_work GET    /artists/:artist_id/art_works/new(.:format)                      art_works#new
         edit_artist_art_work GET    /artists/:artist_id/art_works/:id/edit(.:format)                 art_works#edit
              artist_art_work GET    /artists/:artist_id/art_works/:id(.:format)                      art_works#show
                              PUT    /artists/:artist_id/art_works/:id(.:format)                      art_works#update
                              DELETE /artists/:artist_id/art_works/:id(.:format)                      art_works#destroy
@artwork, :url => artist_art_works_path(current_artist) :multipart => true
@artwork, :url => artist_art_works_path(current_artist), :multipart => true