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

www.blogsaic.com
search, post, blog

<% if not [‘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

nice and easy, cheers joe.b

On 9/21/06, joeb [email protected] wrote:

params[:action]==‘feedback’%>

Peters

<%end%>




cheers

dion


www.blogsaic.com
search, post, blog

------=_Part_4136_19387732.1158841223075–

www.blogsaic.com
search, post, blog

joeb <[email protected]…> writes:

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

If you’re feeling adventurous,

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

Thomas, Mark - BLS CTR wrote:

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.

On Sep 21, 2006, at 5:20 AM, Dion H. wrote:

what is a sexier way of doing this

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

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

<% 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”"""

That fixes only 1 out of the 3 failing cases…

Thomas, Mark - BLS CTR wrote:

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.

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

Nice. Here’s something a bit different:

<% case params[:action] when ‘login’,‘signup’,‘feedback’ %>
<% else %>

<% end %>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs