Newb Newb wrote:
> 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"
As the first of a great many minor issues with this code, you can DRY it by
stashing each parameter as you 'if' it...
if userinfo = params[:userinfo]
if (company_id = userinfo[:company_id]) == nil or
company_id == 'Select Company'
...but there are also major issues. Your <select> options should use an id in
their value='' attributes, and the one for 'Select Company' should be nil...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---