[Facebooker-talk] Problems with *_path() and *_url() helpers when using Publisher

Christopher Bailey chris at cobaltedge.com
Mon Apr 7 16:48:17 EDT 2008


Nick, what version of Rails are you using?  I've run into issues in this
same area under Rails 1.2.x.  My app will be moved to Rails 2 in the future,
but it's a serious undertaking for us, so I haven't been able to move it and
test out whether Rails 2 solves these problems.  Thus, I'm interested to
know your Rails version and if that may play into it or not.

On Mon, Apr 7, 2008 at 1:30 PM, Nick Holland <nick.a.holland at gmail.com>
wrote:

> Mike,
>
> As requested, here is the code involved:
>
> routes.rb
> --------------------------
>
> ActionController::Routing::Routes.draw do |map|
>  map.resource :home
> end
>
> event_publisher.rb
> --------------------------
>
> class EventPublisher < Facebooker::Rails::Publisher
>  include ActionController::UrlWriter
>
>  def profile_update(uid, session)
>   user = Facebooker::User.new(uid, session)
>   send_as :profile
>   from user
>   recipients user
>
>   Facebooker::Session.current = session
>
>   profile render(:partial => 'profile/profile' )
>  end
> end
>
> _profile.fbml.erb
> ----------------------
>
> <%= render(:partial => 'profile/style' ) %>
>
> <div id="content" class="wide">
>  <%= link_to 'test', home_path %>
> </div>
>
> ----------------------
>
> Pretty basic stuff -- I hope I'm doing something thats obvious so I
> can get this fixed up ;) I am using resource routes throughout the
> rest of my code without issue. It is just partials under Publisher
> that fail.
>
> Thanks,
> Nick
>
> On Mon, Apr 7, 2008 at 7:50 AM, Mike Mangino <mmangino at elevatedrails.com>
> wrote:
> > Can you show the exact code you are using and also let us know what
> version
> > of Rails you are using?
> >
> >
> >
> >  On Apr 5, 2008, at 4:47 PM, Nick Holland wrote:
> >
> > > Hello!
> > >
> > > Thanks for the response Mike and Nicholaus. I apologize for the delay
> > > in replying, but I have been deep in development mode and deploying my
> > > Facebook Application.
> > >
> > > I was running an older version of Facebooker, so I thought I'd try and
> > > upgrade my application today to the newest version. Happy to see that
> > > a number of bugs have been fixed that I had money patches for, but I
> > > still am experiencing some issues using *_path() style paths in
> > > partials under the Publisher framework.
> > >
> > > There has been a change in the errors I receive, though. I do not
> > > receive the previous error "undefined method `default_url_options' for
> > > ActionView::Base:Class", anymore. There is a path returned, but it is
> > > relative. I attempted modifying my code to use ":only_path => false"
> > > in my _path method call, to see if I'd receive a full, absolute URL
> > > with my application path. Unfortunately, I receive an exception which
> > > was caught by my event processor:
> > >
> > > "Missing host to link to! Please provide :host parameter or set
> > > default_url_options[:host]"
> > >
> > > I took a look in the publisher code and see that default_url_options
> > > method is indeed defined and looks right. Just for laughs, I copied
> > > this decleration into my own publisher class, to see if it would work.
> > > I still receive the same error.
> > >
> > > It looks like we are getting closer to solving the problem. I hope one
> > > of you with some more intimaacy with this framework could assist me,
> > > as currently I have to build all my publisher URLs in my partials
> > > manually as strings (yuck!).
> > >
> > > Thanks for your assistance, I greatly appreciate it!
> > >
> > > - Nick
> > >
> > > On Thu, Apr 3, 2008 at 1:28 PM, Nicholaus Ames
> > > <nicholaus.l.ames at gmail.com> wrote:
> > >
> > > > Nick,
> > > > Did you ever get the url_helpers in there?
> > > >
> > > > Nick
> > > >
> > > >
> > > >
> > > > On Sun, Mar 30, 2008 at 10:26 PM, Nick Holland
> > <nick.a.holland at gmail.com> wrote:
> > > >
> > > > > Hello,
> > > > >
> > > > > I am running into issues using *_path() and *_url() helpers the
> > > > > Facebooker Publisher framework. I encounter the following error
> when
> > > > > using these helpers while *inside of a partial*:
> > > > >
> > > > > undefined method `default_url_options' for ActionView::Base:Class
> > > > >
> > > > > I've seen a few other people speak about this issue, yet I haven't
> > > > > seen any resolution on the mailing list yet. Here is an example
> stub
> > > > > method that I am using the partial in:
> > > > >
> > > > >  def simple_notification(event_data, partial_name)
> > > > >   send_as :notification
> > > > >   from event_data[:user]
> > > > >   recipients event_data[:target_uids]
> > > > >   fbml render(:partial => "event/notification/" + partial_name,
> > > > > :event => event_data[:event])
> > > > >  end
> > > > >
> > > > > Note, _path() and _url() helpers work flawlessly from the
> > > > > simple_notification method's context, but fails miserably inside
> the
> > > > > partial. I assume this issue also exists with asset helpers.
> > > > >
> > > > > Any ideas? Am I missing something?
> > > > >
> > > > > Thanks,
> > > > > Nick Holland.
> > > > >
> > > >
> > > >
> > > >
> > > > > _______________________________________________
> > > > > Facebooker-talk mailing list
> > > > > Facebooker-talk at rubyforge.org
> > > > > http://rubyforge.org/mailman/listinfo/facebooker-talk
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Nicholaus Ames
> > > > 503-544-5813
> > > > ri.niculo.us
> > > >
> > > >
> > > _______________________________________________
> > > Facebooker-talk mailing list
> > > Facebooker-talk at rubyforge.org
> > > http://rubyforge.org/mailman/listinfo/facebooker-talk
> > >
> >
> >  --
> >
> >  Mike Mangino
> >  http://www.elevatedrails.com
> >
> >
> >
> >
> _______________________________________________
> Facebooker-talk mailing list
> Facebooker-talk at rubyforge.org
> http://rubyforge.org/mailman/listinfo/facebooker-talk
>



-- 
Christopher Bailey
Cobalt Edge LLC
http://cobaltedge.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080407/0bf07fe5/attachment.html 


More information about the Facebooker-talk mailing list