I have a rails app.  I understand how to create a function in Rails.

I have a contact that is viewable by multiple users.  I want to create a 
function to lock and unlock the contact.  I have a field in the contact 
database called locked.

I assume I create a new function in the action controller or contact 
controller like:

def lock(contact_id)
  c=Contact.find(contact_id)
  c.locked = 1
  c.save
end

def unlock(contact_id)
  c=Contact.find(contact_id)
  c.locked = 0
  c.save
end


Is this the proper way to do this?  How do I make sure it's not 
accessible through the through the URL: /Contacts/lock?

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to