Google

Monday, November 12, 2007

things to remember: network scanning tools, and painful ror select tags

i literally spent half day on using select_tag with options_for_select using ror.
ouch.

in theory
<%= select_tag 'table_name[field_name]', options_for_select([array of options list],'what is inserted in table table_name field field_name as value') %>

to get the select list showing up w/ prepopulated data.

why spend whole half day?

hmm... well, the field i am trying to pre-populate have mysql db table with type enum. i think that's why it's not working for the category i am building. works for 'os' which have data type as string works after a few try. should i add '.to_i' to get the enum map to the integer value of the list? how stupid it feels. continue on hacking.

so far it works for:

<%= select_tag 'testtable[target_os]', options_for_select(["", "Windows", "OS X", "Linux"], @testtable.target_os) %>


and

<%= select_tag 'testtable[target_browser]', options_for_select(["", "Firefox", "IE", "Safari", "opera"], @testtable.target_browser) %>


with

@testtable = TestTable.find(params[:id])

in my controller's class method.

Oh, i also better not forget how to use ss and nmap.

'ss -l' in most cases and 'nmap -A -T4 hostname' tells me what ports i am using. not sure if it's weather or just banging my head of this select_tag, but it took me forever to remember these two. Actually I had to ask around for ss. What a monday...

2 Comments:

At 2:45 PM, Anonymous Anonymous said...

hey there, i'm just looking around.

 
At 1:53 AM, Anonymous Anonymous said...

This comment has been removed by a blog administrator.

 

Post a Comment

<< Home