Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- before_filter :load_page
- def new
- @picture = @page.build_picture
- respond_to do |format|
- format.html
- format.xml { render :xml => @picture }
- end
- end
- def create
- @picture = @page.build_picture(params[:id]) #@page.picture.new(params[:picture])
- respond_to do |format|
- if @picture.save
- flash[:notice] = 'Picture was successfully created.'
- format.html { redirect_to page_path(@page) }
- format.xml { render :xml => @picture, :status => :created, :location => @page }
- else
- format.html { render :action => "new" }
- format.xml { render :xml => @picture.errors, :status => :unprocessable_entity }
- end
- end
- end
- protected
- def load_page
- @page = Page.find(params[:page_id])
- end
Add Comment
Please, Sign In to add comment