Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query methods for parents #22

Open
mices opened this issue Sep 23, 2018 · 1 comment
Open

query methods for parents #22

mices opened this issue Sep 23, 2018 · 1 comment

Comments

@mices
Copy link

mices commented Sep 23, 2018

I'm trying to do something like the code shown below but rails returns undefined method name for nil
% if @person.parents %>
<% if @person.mother %>


Mother:
<%= @person.mother.name %>


<% end %>

<% if @person.father %>
   	<p>
	  <strong>Father:</strong>
	  <%= @person.father.name %>
	</p>
<% end %>  

<% end %>

@masciugo
Copy link
Owner

masciugo commented Oct 3, 2018

it seems that @person does not have a father

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants