[Facebooker-talk] redirect with application add

David Clements digidigo at gmail.com
Wed Aug 20 15:09:04 EDT 2008


Cool.

1) new_api?  is newish I think.

2) I think we have a custom starts_with , some legacy thing.

3) The next path is definitely kludgey.  I'd love to see what you have.

Also, one note.  If you notice the code that adds the "/" to the path.  I am
not sure if that is currently necessary but there was a difference between
the new facebook implementation and the old implementation of the next
parameter.

Dave


On Wed, Aug 20, 2008 at 11:27 AM, Ken Schroeder <schroeder.ken at gmail.com>wrote:

> Tthis worked great with a few changes for me.
>
> Had problems with Facebooker::FacebookAdapter.new_api?  Is that in a newer
> facebooker release?
>
> Also not sure if you know you have a typo with starts_with("fb") should be
> starts_with?("fb")
>
> Additionally I modified how you handled the path creation to not use the
> action since restful paths don't contain show or index in the url which for
> my use would be the generally used method I need to reference this.
> Probably have to case out the action if I expect something to go to edit.
>
> Thanks again --ken s.
>
>
>
> On Tue, Aug 19, 2008 at 4:54 PM, David Clements <digidigo at gmail.com>wrote:
>
>> Oh I think I misunderstood the issue... You want to redirect the user back
>> to the original requested URL after they add the app, right?
>>
>> This is what I do:
>>
>>  # Override this so that we get redirected to the right place.
>>   def application_is_not_installed_by_facebook_user
>>     redirect_to new_facebook_session.install_url(:next => next_path() )
>>   end
>>
>>  def next_path
>>     path = "#{params[:controller]}/#{params[:action]}?"
>>     path = "/#{path}" unless Facebooker::FacebookAdapter.new_api? ||
>> Facebooker.is_for?(:bebo)
>>
>>     non_keys = ["controller", "method", "action","format", "_method",
>> "auth_token"]
>>     parts = []
>>     params.each do |k,v|
>>       next if non_keys.include?(k.to_s) || k.to_s.starts_with("fb")
>>       parts << "#{k}=#{v}"
>>     end
>>     path + parts.join("&")
>>   end
>>
>>
>>
>>
>>
>> On Tue, Aug 19, 2008 at 2:45 PM, David Clements <
>> david.g.clements at gmail.com> wrote:
>>
>>> The call to ensure application is added acts just like a before filter.
>>>  So you can exclude certain actions if they do not require adding the app.
>>>
>>> Dave
>>>
>>> Sent from my iPhone
>>>
>>> Dave
>>>
>>>
>>> On Aug 19, 2008, at 2:27 PM, "Ken Schroeder" <schroeder.ken at gmail.com>
>>> wrote:
>>>
>>>  There are groups within our app that people can be invited too. If a
>>>> user recieves an invite to a group and hasn't yet added the application the
>>>> filter chain ends up redirecting them to the main canvas page instead of the
>>>> the group page directly.  Is there a way to handle this if the user hasn't
>>>> installed the app, I tried redirect_back_or_default in one of my controllers
>>>> but it ended up putting me into a loop.
>>>>  _______________________________________________
>>>> Facebooker-talk mailing list
>>>> Facebooker-talk at rubyforge.org
>>>> http://rubyforge.org/mailman/listinfo/facebooker-talk
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20080820/a8dca6cc/attachment.html>


More information about the Facebooker-talk mailing list