Hi..
Any ways to optimise this conditions using ternery operator
if params[:userinfo]
if params[:userinfo][:company_id] == nil or
params[:userinfo][:company_id]
== "Select Company"
company_id = nil
else
company_id = params[:userinfo][:company_id]
end
if params[:userinfo][:department_id] == nil or
params[:userinfo][:department_id] == "Select Department" or
params[:userinfo][:department_id] == "Any Department"
department_id = nil
else
department_id = params[:userinfo][:department_id]
end
if params[:userinfo][:role_id] == nil or
params[:userinfo][:role_id] == "Select Role" or
params[:userinfo][:role_id] == "Any Role"
role_id = nil
puts "here"
else
role_id = params[:userinfo][:role_id]
puts "els"
end
online_status = params[:userinfo][:online_status]
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---