Skip to content

Instantly share code, notes, and snippets.

View blizzerand's full-sized avatar
👨‍💻
Inventing

Manjunath blizzerand

👨‍💻
Inventing
View GitHub Profile
@blizzerand
blizzerand / gist:2471972
Created April 23, 2012 16:13
rubysource
<%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %>
<a href="/users/1" onclick="if (confirm('Are you sure?')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', '_method'); m.setAttribute('value', 'delete'); f.appendChild(m);var s = document.createElement('input'); s.setAttribute('type', 'hidden'); s.setAttribute('name', 'authenticity_token'); s.setAttribute('value', 'FqAHj1L667xA8SmeQjHvVncy8WJz0shaoKjiLHbhQT0='); f.appendChild(s);f.submit(); };return false;">Destroy</a>
<%= link_to_remote 'Edit', :url => edit_user_path(user) %>
<a href="#" onclick="new Ajax.Request('/users/1/edit', {asynchronous:true, evalScripts:true, parameters:'authenticity_token=' + encodeURIComponent('FqAHj1L667xA8SmeQjHvVncy8WJz0shaoKjiLHbhQT0=')}); return
false;">Edit</a>
<%= link_to 'Edit' ,edit_user_path(user) , :remote => true %>
<a href="/users/3/edit" data-remote="true">Edit</a>
Model.find(:all,:conditions => {} )
User.find(:all,:conditions => {:admin => true} )
Model.where('your conidtion')
User.where("admin =?",true)