Skip to content

Instantly share code, notes, and snippets.

@alexw23
Created September 21, 2012 22:52
Show Gist options
  • Save alexw23/3764372 to your computer and use it in GitHub Desktop.
Save alexw23/3764372 to your computer and use it in GitHub Desktop.
def show
@company = Company.find(params[:id], :include => :company_location)
respond_to do |format|
format.html # show.html.erb
format.json { render json: @company }
end
end
<%= @company.company_name %> @ <%= @company.company_location %>
Output:
ChocoLát Beauty @ [#<CompanyLocation deal_id: 0, company_id: 1, lng: "34434", lat: "3434", address: "fdfsfd">]
<%= @company.company_name %> @ <%= @company.company_location.address %>
Output (error):
undefined method `address' for #<ActiveRecord::Relation:0x007fc55b6793c8>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment