2013-09-24 2 views
1

ActiveAdmin gem이있는 레일 3 앱이 있습니다. 관리자가 업데이트 할 수있는 내 웹 사이트 정적 페이지 목록을 보여주는 page.rb 파일을 만들었습니다. 구체적인 필요에 따라 세관을 보았습니다. 페이지를 업데이트하려고 할 때를 제외하고는 모두 잘 작동합니다. The action 'update' could not be found for Admin::PagesController이라는 오류 메시지가 나타납니다. 그러나 내 page.rb 파일은 업데이트 방법을 소유하고 있습니다! 누군가 내가 잘못한 것을 설명 할 수 있습니까?Admin : PagesController에 대한 'update'작업을 찾을 수 없습니다.

내 page.rb 파일 :

ActiveAdmin.register_page 'Pages' do 
    content only: :index do 
    render 'index' 
    end 

    content only: :edit do 
    render partial: 'edit' 
    end 

    controller do 
    layout 'active_admin' 

    def index 
     @search = Page.includes(:translations).where("page_translations.locale='fr'").metasearch(params[:search]) 
     @pages = @search.page params[:page] 
    end 

    def edit 
     @page = Page.find params[:id] 
    end 
    end 

    def update 
    @page = Page.find(params[:id]) 
    @page.update_attributes(params[:page]) 
    redirect_to(admin_path :notice => 'Coool') 
    return 
    end 
end 

그리고 페이지를 제출 양식 :

<%= semantic_form_for([:admin, @page], url: admin_page_path, method: :put) do |f| %> 
    <%= f.inputs do %> 
    <%= f.input :permalink %> 
    <%= f.globalize_fields_for :fr do |g| %> 
     <%= g.text_field :name %> 
     <%= g.text_area :content %> 
    <% end %> 
    <%= f.globalize_fields_for :en do |g| %> 
     <%= g.text_field :name %> 
     <%= g.text_area :content %> 
    <% end %> 
    <% end %> 
    <%= f.button "Save" %> 
    <%= link_to("Cancel", admin_pages_path) %> 
<% end %> 

답변

1

당신의 update 방법은 controller 블록 내부 없습니다. 몇 줄 높이로 옮기십시오.

+0

감사합니다. 나는 눈이 멀었습니다. ... –

+0

하나의 잘못된 장소 '끝'이며 아래의 모든 내용이 무시됩니다 ... 감사합니다. – brntsllvn

관련 문제