Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

willened's Profile

GitHub User: willened

Comments by

Avatar

Now it works, it was a routing problem.

Avatar

I'm pretty new to rails and mercury and I have some troubles to save.

I've implemented the editor on one controller and I want to send the save request to the same controller. I want to update so i use the "PUT" method right.

But the lo tells me that there is no route to url.

Controller:
  def update
  .
  .
  .
  end


  include Mercury::Authentication

  layout :layout_with_mercury
  helper_method :is_editing?

  private

  def layout_with_mercury
    !params[:mercury_frame] && is_editing? ? 'mercury' : 'application'
  end

  def is_editing?
    cookies[:editing] == 'true' && can_edit?
  end
mercury.html.erb
    <script type="text/javascript">
      // Set to the url that you want to save any given page to, leave null for default handling.
      var saveUrl = null

      // Instantiate the PageEditor
      new Mercury.PageEditor(saveUrl, {
        saveStyle: 'form', // 'form', or 'json' (default json)
        saveMethod: 'PUT', // 'PUT', or 'POST', (create, vs. update -- default PUT)
        visible:    true  // boolean - if the interface should start visible or not
      });
    </script>
routes.rb
Pitchdot::Application.routes.draw do
  
 
  mount Mercury::Engine => '/'

 resources :users
 resources :sessions, only: [:new, :create, :destroy]
 resources :pitchdecks 
 
  get "static_pages/privacy"

  root to: 'static_pages#home'
  
  match '/signup',  to: 'users#new'
  match '/signin',  to: 'sessions#new'
  match '/signout', to: 'sessions#destroy', via: :delete
 
  match '/help',    to: 'static_pages#help'
  match '/about',   to: 'static_pages#about'
  match '/jobs',    to: 'static_pages#jobs'
  match '/terms',   to: 'static_pages#terms'
  match '/privacy', to: 'static_pages#privacy'

end

Maybe you can help me. Thanks!