Ruby on Rails
Tuesday, June 16, 2015
It's political or social question rather than technical, and should be asked on resources like reddit. or 4chan.
On Tue, Jun 16, 2015 at 10:26 PM, Vladimir Gordeev <gordeev.vladimir.v@gmail.com> wrote:
> We exist in the 21st Century where a request for gender must be done with sensitivity
=(On Tue, Jun 16, 2015 at 2:09 AM, Elizabeth McGurty <emcgurty2@gmail.com> wrote:Original Post:--
please help solve the problem.
There is a table users:
id :integer, autoincrement
name :string
gender_id :integer
There is a table genders:
id :integer, autoincrement
gender_name :string
model User:
class User < ActiveRecord::Base
belongs_to :gender
end
model Gender:
class Gender < ActiveRecord::Base
has_many :users
end
I need the gendername. I try to do so:
<% @users.each do |user| %>
<div class="col-xs-6"><%= user.name %></div>
<div class="col-xs-2"><%= user.gender_id %></div>
<% end %>
the result is output number, but I need to gendername
p.s.
so I tried:
<div class="col-xs-2"><%= user.gender.gender_name %></div>
in this case receives the following error message:
undefined method `gender_name' for nil:NilClass
Dear All,
I think that this post raises interesting issues regarding the gathering of a user's gender. The developer is evidently not requiring user indication of gender, and has problems in the event of null. Perhaps that matter is optional. If so, why didn't the developer provide an option for "User Declines" as an example. But generally I think this matter is very important. We exist in the 21st Century where a request for gender must be done with sensitivity. What is the convention in this matter?
Thanks,
Liz
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/197b4846-d833-4732-9caf-847623e15711%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAP1h_xcuKgBmHq1tg1pm1%3D8y_G08uHHnVROEmma4CUrty2eRyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment