Is there a better way to do this? im kinda ending up having a lot of if statements. Any hints would be great!
if params[:custom_url] || params[:user_id]
if !params[:user_id].blank?
@user = User.find(params[:user_id]).first
@url = @user.custom_url
else
@url = params[:custom_url]
@user = User.where(:custom_url => @url).first
end
end
!params[:user_id].blank?, you can writeparams[:user_id].present?which reads more nicely. – rubiii Aug 11 '12 at 12:23