my ruby is ugly

what is a sexier way of doing this

<% if not params[:action]==‘login’ and not params[:action]==‘signup’ and not params[:action]==‘feedback’%>

Helen clark vs Winston Peters

<%end%>

cheers

dion

<% if not ['login','signup','feedback'].include? (params[:action])'%>
...

Dion Hewson wrote:

<% if not params[:action]=='login' and not params[:action]=='signup' and not
params[:action]=='feedback'%>

'loginsignupfeedback'.match('login') => """"true""""

'loginsignupfeedback'.match('register') => nil

nice and easy, cheers joe.b

joeb <joe.blauer@...> writes:

<% if not ['login','signup','feedback'].include? (params[:action])'%>

If you're feeling adventurous,

<% unless ['login','signup','feedback'].include? (params[:action])' %>

> <% if not params[:action]=='login' and not
params[:action]=='signup'
> and not params[:action]=='feedback'%>

'loginsignupfeedback'.match('login') => """"true""""

'loginsignupfeedback'.match('register') => nil

This is not a good idea. The following are also true:

'loginsignupfeedback'.match('log')
'loginsignupfeedback'.match('feed')
'loginsignupfeedback'.match('insign')

Thomas, Mark - BLS CTR wrote:

<% if not params[:action]=='login' and not
      

params[:action]=='signup'
    

and not params[:action]=='feedback'%>
      

'loginsignupfeedback'.match('login') => """"true""""

'loginsignupfeedback'.match('register') => nil
    
This is not a good idea. The following are also true:

'loginsignupfeedback'.match('log')
'loginsignupfeedback'.match('feed')
'loginsignupfeedback'.match('insign')
  

Then do it this way:

'login,signup,feedback'.match('login') => """"true""""

:slight_smile:

All the Best!
Sergey.

<% if not ['login','signup','feedback'].include? (params[:action])'%>

...

Nice. Here's something a bit different:

  <% case params[:action] when 'login','signup','feedback' %>
  <% else %>
  ...
  <% end %>

You've received good advice on Ruby, but I think you should include that advice with a Rails helper...

<% if normal_request %>

and in your helper...

def normal_request
   # logic of your choice goes here
end

>> 'loginsignupfeedback'.match('login') => """"true""""
>>
>> 'loginsignupfeedback'.match('register') => nil
>>
>
> This is not a good idea. The following are also true:
>
> 'loginsignupfeedback'.match('log')
> 'loginsignupfeedback'.match('feed')
> 'loginsignupfeedback'.match('insign')
>
Then do it this way:

'login,signup,feedback'.match('login') => """"true""""

That fixes only 1 out of the 3 failing cases...

Thomas, Mark - BLS CTR wrote:

'loginsignupfeedback'.match('login') => """"true""""

'loginsignupfeedback'.match('register') => nil
    

This is not a good idea. The following are also true:

'loginsignupfeedback'.match('log')
'loginsignupfeedback'.match('feed')
'loginsignupfeedback'.match('insign')
  

Then do it this way:

'login,signup,feedback'.match('login') => """"true""""
    
That fixes only 1 out of the 3 failing cases...
  
I agree. That was fast morning partially correct answer that I realized
after I sent that email.

PS: I need more coffee =)

All the Best!
Sergey.