ramona guzek | 1 Nov 2006 21:47
Picon
Favicon

mailinglist

ied liketo be put onthe mailing list for campin list
 


Image by FlamingText.com
_______________________________________________
Camping-list mailing list
Camping-list@...
http://rubyforge.org/mailman/listinfo/camping-list
Geoffrey Grosenbach | 3 Nov 2006 18:42
Gravatar

[OT] Markaby trunk and Rails ivars

Can someone explain the new Markaby syntax to me? I'm using Markaby  
as a Rails plugin, fetched from the trunk.

I'm losing my instance variables somehow ( <at> thing is always nil):

class ThingsController < ApplicationController
   def index
      <at> thing = "Bacon of the chunky variety"
   end
end

# app/views/index.mab
h1 { "You should see a thing here:" }
p {  <at> thing }

And I get a NoMethodError when trying to get at it with the thing()  
method, as mentioned in the README.

I can, however, get to the instance variable like this:

 <at> thing =  <at> helpers.controller.assigns['thing']

What am I doing wrong?

Geoff
Tim Fletcher | 4 Nov 2006 13:21
Picon

Re: [OT] Markaby trunk and Rails ivars

Yeah, this is my fault - sorry for the breakage :)

p { thing } should work just fine now (as of r91).

The idea behind these recent changes is to keep instance variables for Markaby's
own purposes, and force everything else coming in from outside (i.e.
controllers)
to go through method_missing. The code is a bit cleaner as a result.

Any objections to the new style?

Tim

On 03/11/06, Geoffrey Grosenbach <boss@...> wrote:
> Can someone explain the new Markaby syntax to me? I'm using Markaby
> as a Rails plugin, fetched from the trunk.
>
> I'm losing my instance variables somehow ( <at> thing is always nil):
>
> class ThingsController < ApplicationController
>    def index
>       <at> thing = "Bacon of the chunky variety"
>    end
> end
>
> # app/views/index.mab
> h1 { "You should see a thing here:" }
> p {  <at> thing }
>
>
> And I get a NoMethodError when trying to get at it with the thing()
> method, as mentioned in the README.
>
> I can, however, get to the instance variable like this:
>
>  <at> thing =  <at> helpers.controller.assigns['thing']
>
>
> What am I doing wrong?
>
> Geoff
>
> _______________________________________________
> Camping-list mailing list
> Camping-list@...
> http://rubyforge.org/mailman/listinfo/camping-list
>
Geoffrey Grosenbach | 4 Nov 2006 19:24
Gravatar

Re: [OT] Markaby trunk and Rails ivars

On Nov 4, 2006, at 4:21 AM, Tim Fletcher wrote:
> p { thing } should work just fine now (as of r91).

Works like a dream now, thanks!

Geoff
Geoffrey Grosenbach | 4 Nov 2006 22:42
Gravatar

A New App, and A Question

Here's my first live Camping app, on the undergroun.d!

http://peep.d

I often need to come up with a color scheme that is made from an  
existing color. This little app takes a hex color and shows all the  
combinations of those colors.

An observation and a question:

At first it was including dispatch.fcgi into generated urls (http:// 
peep.d/dispatch.fcgi/colors). I renamed it to dispatch.rb and that  
helped.

However, Camping still adds extra copies of the mount point:

http://peep.d/colors/colors/colors/33/55/ff

It works, but looks a little odd.

I'm using lighttpd with the config from http:// 
code.whytheluckystiff.net/camping/wiki/TheCampingServerForLighttpd. I  
only have one route:

class Index < R '/', '/colors/(\w\w)/(\w\w)/(\w\w)'

The offending link is generated with a splatted array of three strings:

R(Index, *color)

Does anyone have ideas about what I'm doing wrong?

Geoff
Jonas Pfenniger | 5 Nov 2006 10:13
Picon

Re: A New App, and A Question

Hi Geoff,

really nice idea, it will help me too.

To answer your question :

Look in the  <at> root instance variable. It is the path to your
application's root. We already had some problems with FastCgi

--

-- 
Cheers,
  zimbatm

http://zimbatm.oree.ch
Joe Ruby | 5 Nov 2006 20:14
Picon
Favicon

re: Any workaround for Rails caching?

> > I mean fragment caching. I get errors like this:
> >
> > ActionView::TemplateError
> >
(/usr/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:192:in
> > `method_missing': no such method `length') on line
#0
> > of app/views/items/index.mab:
> > 1:
> > 2: cache("#{ <at> site.server_name}/index_items") do
> >
> >
> > Joe
> 
> Yep, the length error is because a lot of Rails'
internals still
> assume ERB, which uses a different buffer structure
to Markaby. I'll
> try to get it working soon.
> 
> Cheers,
> Tim

Do you have any ideas how to approach it? Looking at
Rails' code:

      # Called by CacheHelper#cache
      def cache_erb_fragment(block, name = {}, options
= nil)
        unless perform_caching then block.call; return
end

        buffer = eval("_erbout", block.binding)

        if cache = read_fragment(name, options)
          buffer.concat(cache)
        else
          pos = buffer.length
          block.call
          write_fragment(name, buffer[pos..-1],
options)
        end
      end

It seems like Markaby might have to have a "length"
attribute and/or act like "buffer"? Or would Rails
need to be changed on the eval line?

Joe

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Mark Fredrickson | 14 Nov 2006 07:07
Picon
Gravatar

Re: [UHH] any blogs sprung from camping?

Hello,

I just joined the camping list. I was trolling the archives when I saw this:
--
The biggest problem in Camping is authentication. This is a problem I
propose to solve by providing an extension. That little bit of code
uses the path to allow/disallow urls. That way it is unobstrusive. In
the future I would also like to make an OpenID client and server for
Camping.
--
I was wondering if anyone had gone down the OpenID client/server
route? I'm in the process of writing one myself as a demonstration of
camping for my local ruby group. I'm in the process of writing the
server, and I think I can supply the client as a mixin.

If anyone has done work on this front, I'd be interested to combine
efforts. I too see many opportunities for tiny little gnat sized apps
working together in glorious harmony. And user auth is certainly the
first step.

Cheers,
-Mark
Mark Fredrickson | 14 Nov 2006 07:37
Picon
Gravatar

RESTful mixin, mixin repo?

Hi,

I just put together a little mixin to provide pseudo-RESTful services
in camping apps. Basically, it looks for a hidden _verb field in form
posts, and sets the  <at> method to the supplied value (e.g. put or delete
- which browsers don't support). This lets you define put and delete
methods in your controllers. Groovy.

Code:

http://pastie.caboo.se/22613

Is there any permanent repo of little code snippets/mini-libraries for
Camping? Is the wiki the best place? I think a lot of camping code
could be re-used via mixins and it would be nice to have a
Camping-forge type place to go find existing work.

Cheers,
-Mark
Rodney Ramdas | 14 Nov 2006 08:41
Picon

Re: RESTful mixin, mixin repo?

hey, that's nice

perhaps you could write up a page on the wiki ?

http://code.whytheluckystiff.net/camping/wiki/LikeRails

On 11/14/06, Mark Fredrickson <mark.m.fredrickson@...> wrote:
> Hi,
>
> I just put together a little mixin to provide pseudo-RESTful services
> in camping apps. Basically, it looks for a hidden _verb field in form
> posts, and sets the  <at> method to the supplied value (e.g. put or delete
> - which browsers don't support). This lets you define put and delete
> methods in your controllers. Groovy.
>
> Code:
>
> http://pastie.caboo.se/22613
>
> Is there any permanent repo of little code snippets/mini-libraries for
> Camping? Is the wiki the best place? I think a lot of camping code
> could be re-used via mixins and it would be nice to have a
> Camping-forge type place to go find existing work.
>
> Cheers,
> -Mark
> _______________________________________________
> Camping-list mailing list
> Camping-list@...
> http://rubyforge.org/mailman/listinfo/camping-list
>

--

-- 
Rodney
http://www.pinupgeek.com
http://www.dutchrailers.org

Gmane