Forum: Ruby on Rails Article: Open Says Me

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
496ed7f402fc56b1f997855941272ad4?d=identicon&s=25 Pete Forde (Guest)
on 2006-04-26 23:56
(Received via mailing list)
I just finished my latest contribution, "Open Says Me".

http://unspace.ca/discover/opensaysme/

Managing the browser experience using JavaScript, Ajax and a Cookie.

It's built on top of Rails, of course. Feedback is always appreciated!

Pete
57e939ff00f9df2670a09f417c08da5e?d=identicon&s=25 Josh Knowles (Guest)
on 2006-04-27 00:14
(Received via mailing list)
On 4/26/06, Pete Forde <pete@unspace.ca> wrote:
>
> I just finished my latest contribution, "Open Says Me".
>
> http://unspace.ca/discover/opensaysme/
>
> Managing the browser experience using JavaScript, Ajax and a Cookie.
>
> It's built on top of Rails, of course. Feedback is always appreciated!



Great article, love the idea, the only thing that turns me off is the
need
for multiple controllers.  I'm wondering if you can use respond_to, or a
similar mechanism to handle the backwards compatibility.  By keeping a
single controller you are reducing the risk of repeating your business
logic
in multiple places.

Something like this perhaps:

<pseudocode>

def show
  broswer.supports do |type|
    type.flash?
      render ui.flash
    type.cookies? && type.ajax?
      render ui.v2.0
    default
      render ui.v1.0
  end
end

</pseudocode>

Thoughts?

Josh
496ed7f402fc56b1f997855941272ad4?d=identicon&s=25 Pete Forde (Guest)
on 2006-04-27 00:33
(Received via mailing list)
Hey Josh!

Thanks for the kind words.

I try to keep my articles super-conceptual so that people that read them
are more likely to apply the ideas to their problem domain.

before_filter is awesome for its' simplicity, but in lots of cases -
it's overkill. respond_to would definately work on a per-page basis.

See - when I write, I always try to sneak in gratuitous "look how easy
this was to do with Rails!" subliminal messages. PHP developers don't
have before_filter functionality. *

Pete

* do they?
  ----- Original Message -----
  From: Josh Knowles
  To: rails@lists.rubyonrails.org
  Sent: Wednesday, April 26, 2006 6:13 PM
  Subject: Re: [Rails] Article: Open Says Me



  On 4/26/06, Pete Forde <pete@unspace.ca> wrote:
    I just finished my latest contribution, "Open Says Me".

    http://unspace.ca/discover/opensaysme/

    Managing the browser experience using JavaScript, Ajax and a Cookie.

    It's built on top of Rails, of course. Feedback is always
appreciated!


  Great article, love the idea, the only thing that turns me off is the
need for multiple controllers.  I'm wondering if you can use respond_to,
or a similar mechanism to handle the backwards compatibility.  By
keeping a single controller you are reducing the risk of repeating your
business logic in multiple places.

  Something like this perhaps:

  <pseudocode>

  def show
    broswer.supports do |type|
      type.flash?
        render ui.flash
      type.cookies? && type.ajax?
        render ui.v2.0
      default
        render ui.v1.0
    end
  end

  </pseudocode>

  Thoughts?

  Josh


------------------------------------------------------------------------------


  _______________________________________________
  Rails mailing list
  Rails@lists.rubyonrails.org
  http://lists.rubyonrails.org/mailman/listinfo/rails
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (Guest)
on 2006-04-27 08:37
(Received via mailing list)
Pete Forde wrote:
> See - when I write, I always try to sneak in gratuitous "look how easy
> this was to do with Rails!" subliminal messages. PHP developers don't
> have before_filter functionality. *
>
> Pete
>
> * do they?
At the php.ini-level, yes.  You can specify a file to get processed
before anything else gets loaded.

I added something more similar to before_filter to a PHP framework I was
working on last year which, over time, started to look remarkably
familiar :-)
This topic is locked and can not be replied to.