I'm getting this error message:

undefined method `to_model' for #<Organisation:0x00007f2d15c1cef8> Did you 
mean? to_yaml


class OrganisationsController < ApplicationController
  before_action :set_organisation, only: [:show, :edit, :update, :destroy]

  # etc etc all the usual boiler plate when a scaffold is created:

  # GET /organisations/1/edit
  def edit
  end

  private
  # Use callbacks to share common setup or constraints between actions.
  def set_organisation
    @organisation = Organisation.find(id: params[:id])
  end

  # Never trust parameters from the scary internet, only allow the white 
list through.
  def organisation_params
    params.require(:organisation).permit(:name, :registration_no)
  end
end

## Here is the edit view
<h1>Editing Organisation</h1>
<%= render 'form', organisation: @organisation %>


## And here is the form:
## The error message is happening here: when adding organisation to the 
hash.
<%= form_with(model: organisation, local: true) do |form| %>
  <% if organisation.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(organisation.errors.count, "error") %> prohibited 
this organisation from being saved:</h2>
      <ul>
        <% organisation.errors.full_messages.each do |message| %>
          <li><%= message %></li>
        <% end %>
      </ul>
    </div>
  <% end %>
  <div class="field">
    <%= form.label :name %>
    <%= form.text_field :name %>
  </div>
  <div class="field">
    <%= form.label :registration_no %>
    <%= form.text_field :registration_no %>
  </div>
  <div class="actions">
    <%= form.submit %>
  </div>
<% end %>


Any pointers would be much appreciated.

Chrs

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/0c589949-fef9-4ada-aec3-474b6051eb9b%40googlegroups.com.

Reply via email to