Hello, I've been working on this minor enhancement for a while now
--- apparently I've accomplished the easy part, adding two columns,
limit_request and daily_requests, boolean and integer, respectively,
and updated the admin preferences page show and edit views.
The hard part seems to be the remaining few lines of code in app/
controllers/connection_controller.rb that limit a members daily
connection requests within a 24-hour period. Then of course the
testing. So I guess I've accomplished half of the easy part. Other
files changed: app/models/preference.rb /updated attr_accessible/
____________________________________
app/controller/connection_controller.rb
class ConnectionsController < ApplicationController
before_filter :login_required, :setup
before_filter :authorize_view, :only => :index
before_filter :authorize_person, :only => [:edit, :update, :destroy]
before_filter :redirect_for_inactive, :only => [:edit, :update]
.
.
.
def create
@contact = Person.find(params[:person_id])
respond_to do |format|
if Connection.request(current_person, @contact)
flash[:notice] = 'Connection request sent!'
format.html { redirect_to(home_url) }
else
# This should only happen when people do something funky
# like friending themselves.
flash[:notice] = "Invalid connection"
format.html { redirect_to(home_url) }
end
end
end
.
.
.
# Make sure the current person is correct for this connection.
def authorize_person
@connection = Connection.find(params[:id],
:include => [:person, :contact])
unless current_person?(@connection.person)
flash[:error] = "Invalid connection."
redirect_to home_url
end
rescue ActiveRecord::RecordNotFound
flash[:error] = "Invalid or expired connection request"
redirect_to home_url
end
.
.
.
end
--~--~---------~--~----~------------~-------~--~----~
Insoshi developer site: http://dogfood.insoshi.com/
Insoshi documentation: http://docs.insoshi.com/
You received this message because you are subscribed to the Google
Groups "Insoshi" 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/insoshi?hl=en
-~----------~----~----~----~------~----~------~--~---