Skip to content

Instantly share code, notes, and snippets.

@techbrownbags
Last active December 23, 2015 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save techbrownbags/6629400 to your computer and use it in GitHub Desktop.
Save techbrownbags/6629400 to your computer and use it in GitHub Desktop.
class Turbine < ActiveRecord::Base
has_one :turbine_type, foreign_key: "id"
end
class TurbineType < ActiveRecord::Base
end
show.html.erb
<p id="notice"><%= notice %></p>
<p>
<strong>Name:</strong>
<%= @turbine.name %>
</p>
<p>
<strong>Type:</strong>
<%= @turbine.turbine_type.name %>
</p>
<%= link_to 'Edit', edit_turbine_path(@turbine) %> |
<%= link_to 'Back', turbines_path %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment