Re: multi-line input field

2014-05-12 Thread David Susco
textarea rows:'5' @testform.testing doesn't do what you want it to do?


On Mon, May 12, 2014 at 1:51 AM, Sebastjan Hribar 
sebastjan.hri...@gmail.com wrote:

 Hi,

 can someone tell me if multi-line input field is possible to do with
 markaby?

 If I use input tag like so:

 ---

 input type: 'textarea', name: 'testing', value: @testform.testing
 ---


 I can only set the length of the field by providing the size: attribute.

 If I use textarea tag like so:

 ---

 textarea @testform.testing
 ---


 it only make sense for displaying the value.

 I'd like to accomplish multi-line input field. The purpose of such a text
 box is to enter a bit longer comments.

 Can it be done?

 regards,
 seba

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: setting up the SQLite database

2012-05-21 Thread David Susco
On 4:

http://api.rubyonrails.org/classes/ActiveRecord/Migration.html#label-Reversible+Migrations

Looks like you just define the up, AR takes care of the rest. Never
tried it, it'll save a few lines of code though.

On injection, AR sanitizes almost everything I believe. The only thing
I know to avoid is using a user set variable straight in a string:

thing = #{@input.user_var}

That's dangerous, you're supposed to do this:

thing = ?, @input.user_var

Dave

On Mon, May 21, 2012 at 4:52 AM, Dave Everitt dever...@innotts.co.uk wrote:
 Thanks Nokan, Dave, Philippe for your replies, it's good to get a measure of
 standard practice even for things as simple as this.

 There just remains no. 4 (from a question by Isak Andersson
  http://comments.gmane.org/gmane.comp.lang.ruby.camping.general/1751)

 for which I'd like an opinion, since I can't find a definitive answer from
 the AR docs... and can only fond a reference to it on the Ember GitHub
 readme:
  https://github.com/EmberAds/acts_as_uuid

 or slide 21 of this AR intro:
  http://www.slideshare.net/blazingcloud/active-record-introduction-3

 since I've only ever used 'up' and 'down' (and don't use Rails) this isn't
 obvious to me :-)

 Finally, what's a good approach to security (SQL injection?) for a public
 app?

 DaveE


 4.
 There's also this from a previous post (opinions please?):

 On the part of migrations ... def self.up and def self.down ... gave
 me errors for some reason. But ... it should be updated to def self.change
 ... that's the modern way of doing it.

 DaveE


 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Camping Multimount

2012-02-19 Thread David Susco
On the linking thing, could you invoke a method in the main app from a
sub-app which takes a sub-app name and a route as variables? The
method could then just return R() from the appropriate sub-app.

Dave

On Sat, Feb 18, 2012 at 4:55 PM, Isak Andersson icepa...@lavabit.com wrote:
 http://pastebin.com/JuHhW0R

 Not sure what went wrong there :/

 The app is over here https://github.com/MilkshakePanda/Penguin

 I have no idea what that had to do with my config.ru file..



 On Sat, 18 Feb 2012 21:35:39 +0100, Magnus Holm judo...@gmail.com wrote:

 On Fri, Feb 17, 2012 at 22:13, Isak Andersson icepa...@lavabit.com
 wrote:

 Hi, sorry if I'm repeating is email or something, Cinnamon crashed as I
 was
 sending the mail and
 the result in the sent folder was completely empty, so I'm just gonna
 have
 to write it all over
 again, wee!

 Anyways, my question was about new camping and if we still have the
 ability
 to mount multiple smaller
 apps as the bigger app. I'm creating an app to host my blog and a bunch
 of
 other stuff using the new
 Camping version that comes with Mab + Riak. I want to be able to divide
 each
 part of the website into
 it's own app, but I still want them to share some things, like the
 public/
 folder so that they have the
 same look. I also want them to share Riak node which they will do.

 Let's say that my project structure looks something like this

 app/
       app.rb
       blog.rb
       forum.rb        # Not actually having a forum though, probably
       public/
               Style.css
               Coolpic.png
       blog/
               controllers.rb
               views.rb
       forum/
               controllers.rb
               views.rb
       config/
               ripple.yml
               foo.yml

 First off, what is the correct command to mount these parts, and how does
 it
 work? The Camping site says:
 camping apps/**/*.rb.

 I'm not sure what it does though, and if it would still work in the new
 version.


 In the newest (pre-release) version of Camping you solve this by using
 a config.ru-file:

  # in config.ru
  require 'app'
  require 'blog'
  require 'forum'

  map '/' do
    run App
  end

  map '/blog' do
    run Blog
  end

  map '/forum' do
    run Forum
  end

 You can then run `camping config.ru` to start the server.

 One thing that I would like, would be if all sub-apps for app.rb like
 blog
 or forum inherited some of the
 settings of app.rb. I'm using rack_csrf for csrf protection (obviously)
 and
 I find it kind of strange to have to set
 it up for each and every app instead of just app.rb.


 The simplest solution is to define something like this:

  def App.setup(app)
    app.class_eval do
      set :foo, 123
      include Bar
      use Baz
    end
  end

 And then:

  module App
    App.setup(self)
  end

  module Blog
    App.setup(self)
  end

  module Forum
    App.setup(self)
  end


 Another thing, how do I make app.rb the root of the entire site so it's
 mounted at foobar.com and not
 foobar.com/blog like the other ones should be mounted. Also, how do I
 link
 between the different apps?
 Like how do I make app link to the blog or a part of the forum link to a
 certain part of app?


 Linking is indeed a hard problem. By default, Camping+Mab prepends the
 mount path to all links. So if you generate /user/1 inside a
 Forum-template, the link will actually come out as /forum/user/1. Of
 course, this means that linking to /blog/post/1 does actually link
 to /forum/blog/post/1 which probably wasn't what you intended.

 I'm really not sure what's the best solution is here…

 I guess that was all the questions I had about this. I'm starting to feel
 like this would be the ultimate
 way to build a larger Camping app :)


 Have fun :D
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 
 Delivering best online results. Get better, different Relevant results
 fast !
 Searching the best of online online.

 http://click.lavabit.com/4ehcpqntnpwdsxdqu4axg6a3o453mwgxeoghwyzarmthtqqeyhwb/

 



 --
 Using Opera's revolutionary email client: http://www.opera.com/mail/

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Mab: The tiny Markaby-alternative

2011-12-19 Thread David Susco
Stick with the way we're doing it. I only use markaby when it's
easier/prettier to use then HAML (quick one-line helpers and the
like).

Dave

On Mon, Dec 19, 2011 at 4:26 PM, Magnus Holm judo...@gmail.com wrote:
 On Mon, Dec 19, 2011 at 21:34, Isak Andersson icepa...@lavabit.com wrote:
 My suggestion would be to make it Markaby 2.0 (of course, once it's
 running and mostly backwards-compatible), keeping the old gem name,
 and to develop on a branch in markaby repo.


 Yeah, we should more or less do a rewrite and make it properly open source.
 You are allowed to make something with the same name aren't you? I mean
 there
 is songs with the same names after all.

 So what we would have wouldn't exactly be Markaby but it would be used
 exactly
 like Markaby. We could make it smaller/faster and more up to date :)

 Just so everyone knows: Camping doesn't depend on Markaby today. It's
 only loaded when you actually try to use it. Would you suggest that we
 switch to a hard dependency on Markaby, or should we continue what
 we're doing today?
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Mab: The tiny Markaby-alternative

2011-12-19 Thread David Susco
So then I'd have to remember it's the opposite of the way it's been? :P

Dave

On Mon, Dec 19, 2011 at 5:53 PM, Jenna Fox a...@creativepony.com wrote:
 If no hard dependancies, can we switch it around so core camping is in a
 camping-seedling gem, and the regular camping gem is actually the one with
 all the omnibus? I always forget when setting up a new system and end up
 confused why camping isn't working


 —
 Jenna Fox

 On Tuesday, 20 December 2011 at 9:52 AM, Dave Everitt wrote:

 switch to a hard dependency on Markaby, or should we continue what
 we're doing today?


 no hard dependency, continue as today - DaveE
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Camping.use Before, Rack::File.new('public')

2011-12-16 Thread David Susco
I think that's immensely useful. It'll allow me to keep JS/CSS/HTML
separate from the app files but still packaged with the app.

Dave

On Fri, Dec 16, 2011 at 3:13 PM, Magnus Holm judo...@gmail.com wrote:
 Here's one useful snippet:

  def (Before=).new(a,*o)Rack::Cascade.new(oa)end

 This means that this app:

  module App
    use Before, Rack::File.new('public')
  end

 Will pass all requests through Rack::File.new('public') first, and
 only proceed to App if that returns 404. This can be very useful for
 serving static stuff in development mode (Rack::File will serve files
 from the 'public' directory if it matches the URL; e.g.
 ./public/jquery.js will be available at localhost:3301/jquery.js)

 Maybe we should add it to camping.rb?

 // Magnus Holm
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: A question about the ecosystem.

2011-08-31 Thread David Susco
I had to tie into an LDAP db so I just used net/ldap and a class I wrote.

I had problems getting will_paginate to work. I eventually just hacked
together something else. It doesn't really amount to much more than
what I was having to do with will_paginate, so it works for me. :P

Dave

On Tue, Aug 30, 2011 at 6:20 PM, Tim Uckun timuc...@gmail.com wrote:
 On Wed, Aug 31, 2011 at 1:33 AM, David Susco dsu...@gmail.com wrote:
 I've got five camping apps in production. They're mostly CRUDs with
 some basic searching/e-mailing/etc. I use a few third party libraries;
 haml, paper_trail, rack/csrf and redcloth being the main ones. I
 haven't had too much need beyond those but your mileage will vary
 obviously.

 What Camping lacks is a lot of the fluff, but that's what I like the
 most about it. It keeps things simple.


 I like the promise of simplicity too.  What are you using for
 Authentication?  Does simple_form or formtastic work with camping or
 do you use something else for that?  I like Typus as a quick way to
 put up admin sites does anybody know if it works with camping? Has
 anybody tried whenever?

 I presume will paginate, chronic etc will work as long as I stick with
 AR (although honestly I want to try something other than AR too).
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: A question about the ecosystem.

2011-08-30 Thread David Susco
I've got five camping apps in production. They're mostly CRUDs with
some basic searching/e-mailing/etc. I use a few third party libraries;
haml, paper_trail, rack/csrf and redcloth being the main ones. I
haven't had too much need beyond those but your mileage will vary
obviously.

What Camping lacks is a lot of the fluff, but that's what I like the
most about it. It keeps things simple.

Dave

On Tue, Aug 30, 2011 at 6:56 AM, Jenna Fox a...@creativepony.com wrote:
 Hi Tim!

 Camping is a great choice. It's really lean, and quite robust and well 
 performing. So far as rails plugins go - the default choice of database 
 adaptors for Camping is ActiveRecord - so most ActiveRecord-related rails 
 plugins will work. Camping doesn't have things like rail's form builders and 
 validators and the likes, and it also doesn't have activesupport. You might 
 find that installing the activesupport gem and requiring it at the start of 
 your app makes more rails specific code work, by adding in support for things 
 like String#ends_with?

 Overall, there really isn't very much to miss. Camping provides what you need 
 of controllers and views, while the outer shell of rack provides extras you 
 might like. A sampler box of rack features might have some of these: Several 
 flavours of session storage and cookies - including the fastest variety, used 
 by the likes of google and yahoo; Stream compression filters, to gzip 
 whatever you send out, streamlining cinematic immersion and minimising wasted 
 bytes; http validators; html validators; url mapping to bundle several 
 camping apps together in to one; the option of picking and choosing - you can 
 use camping for some of your app and rails or any of the rest for another 
 part.

 I suppose the best feature of camping is the community though. If there's 
 anything you need there's surely someone happy to help.


 —
 Bluebie

 On 30/08/2011, at 8:40 PM, Tim Uckun wrote:

 I am a long time rails developer looking for a new framework which is
 leaner and less complex than rails.  Camping appeals to me for a lot
 of reasons but I am curious about how a moderately conplex app would
 look like in camping.  In rails my Gemfile is full of third party
 libraries and I am wondering if they will all (or most) work with
 camping. My guess is that they won't and I am worried that I will have
 to code up all kinds of functionality I take for granted in the rails
 world.

 Maybe that's a good thing but I wanted to ask you guys about your
 experience in taking advantage of other people's work.

 Cheers.
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Advice on strategy for maintaining state in Camping

2011-08-25 Thread David Susco
If I'm understanding your question correctly I think judicious use of
the @state instance variable will achieve what you're looking for.
You'll be able to store what you need and be able to access it from
request to request.

Another option would be to use sqlite in memory mode.

App::Models::Base.establish_connection(:adapter='sqlite3',
:database=':memory:')

You'll gain the benefits of a database but you'll be working in memory
only, so nothing's stored when your app is off.

Dave

On Thu, Aug 25, 2011 at 9:25 AM, Anders Schneiderman
aschneider...@gmail.com wrote:
 Hi,



 I need a little advice about maintaining state in Camping.



 I use NaturallySpeaking voice recognition software for most of my work -- I
 don't have happy hands -- and I've been creating little Ruby projects to
 make it easier to do some things by voice. I'd like to build a UI for them.
 After some painful experiences with some windows-based UIs, I'd like to try
 using Camping – it looks like fun, and I can use my HTML/CSS skills to make
 something pretty.



 For most of these little Ruby projects, I don't have to store anything in a
 database because the data is already being stored elsewhere. For example,
 I'm managing a team that's building a Microsoft-based data warehouse that
 uses Excel pivot tables as a front-end, and pivot tables are hard to
 manipulate using NaturallySpeaking. On my Camping site, I want to be able to
 display a long list of the available pivot table fields so I can click on
 them by voice.  I also want a text box so I can say, e.g., show department
 and unit by row, year by column or only show fields containing committee.
 So all I need to store is the info I'm using to manipulate the pivot table:
  the connection to the Excel worksheet and a list of the available fields
 that I grab from the Excel worksheet plus one or two properties about these
 fields. I don't need to save any of this info -- I grab it once at the
 beginning of the session, and I don't want to cache it because, for example,
 the list of fields will change depending on which data warehouse cube I'm
 connecting to.  I have other projects where the data is stored on a
 website/application that I'm grabbing/manipulating using Web services/APIs.
 In short, I don't need to permanently store any data, I just need to
 maintain state for a relatively small number of objects.



 What's the easiest way to do this in Camping? Is there a way to cache the
 list of field objects? Or does it make more sense to store them in a
 database and purge  refresh the data in the database each time I start up
 the Camping site?



 Thanks!

 Anders



 PS Maybe you're thinking, using Excel pivot tables as a front-end to a data
 warehouse?? It does sound bizarre, and I was pretty skeptical at first, but
 it actually works pretty well. Microsoft has put a fair amount of work into
 turning Excel pivot tables into a pretty decent data warehouse front end.
 And since you're just using Excel, you get all the goodies are built into
 Excel. Not a good front-end if you are creating straightforward dashboards
 that are totally locked down, but if you have a pretty broad range of fields
 and you're encouraging folks to slice and dice the data themselves, it ends
 up being easier than most of the other tools out there.

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: sending a post request from a controller

2011-07-04 Thread David Susco
They're never providing login credentials, merely going to a payment
gateway that has received a post request. Essentially all I'm asking
is can a camping controller serve as a middle man for a post request
to another url?

Before I did form validation with JS client-side and then posted the
info to SM. Now, I'm asking can I post the info to a camping
controller, do the validation and then send the user off with another
post request. If not, then I'll have to see if I can do the
validation/prep with Ajax instead of a submit, then just post directly
to SM from the form.

Dave

On Mon, Jul 4, 2011 at 10:46 AM, John Beppu john.be...@gmail.com wrote:
 I have a bad feeling about whatever you're trying to do.  However, I want to
 make sure that my interpretation of your intent is correct.

 It sounds like you want to create a web app that provides a form.
 When this form is submitted (and assuming the data is valid), you want to
 POST this data to a URL at https://www.salliemae.com/.
 Then, it sounds like you want to send a redirect so that the user of your
 webapp ends up at an appropriate page at https://www.salliemae.com/
 (possibly with a prefilled form courtesy of your work).

 If this is the case, you have a big problem -- salliemae.com login info is
 needed in too many places.
 Step 2 (which happens on the server side) needs the user's Sallie Mae login
 credentials in order to perform a successful POST, and that's unwise to give
 out.  Your users should never have to trust you with their Sallie Mae
 username and password.  That should be private information, never to be
 given out to 3rd parties (including you).
 Step 3 also requires that the user's browser already be logged in to
 salliemae.com or the redirect wouldn't work.

 I have the feeling that you're trying to simplify a person's user experience
 by prefilling a cumbersome form, but your strategy for doing this may be
 flawed.
 --beppu
 On Sun, Jul 3, 2011 at 8:06 PM, David Susco dsu...@gmail.com wrote:

 They do not, pretty much they need a few input tags and that's about
 it. I'm just looking to do my form validation/preparation server-side
 instead of client-side.

 Dave

 On Sun, Jul 3, 2011 at 9:35 PM, John Beppu john.be...@gmail.com wrote:
  Does Sallie Mae provide a payment processing API?  I searched for it,
  but I
  couldn't find anything.
 
  On Sun, Jul 3, 2011 at 4:46 AM, David Susco dsu...@gmail.com wrote:
 
  None of those, I'm in education, and we have to go through Sallie Mae.
 
  Dave
 
  On Sun, Jul 3, 2011 at 1:16 AM, John Beppu john.be...@gmail.com
  wrote:
   Can you tell us what payment processing system you're trying to work
   with?
   Is it PayPal or Google Checkout?
   Bitcoin?  ;-)
  
   On Thu, Jun 30, 2011 at 6:48 AM, David Susco dsu...@gmail.com
   wrote:
  
   Ideally I'd like a user to be able to submit a form to the camping
   app, having camping do all the validation and some preprocessing and
   then have the camping app send the user to an external site (with
   the
   post data) where the user can complete a payment.
  
   Dave
  
   On Wed, Jun 29, 2011 at 5:00 PM, Steve Klabnik
   st...@steveklabnik.com
   wrote:
No, redirects are an HTTP response, they're not a new request.
Can you give a more concrete example? Your explanation sounds like
you're
trying to do two different things, and I'm not sure which you
mean.
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list
   
  
  
  
   --
   Dave
   ___
   Camping-list mailing list
   Camping-list@rubyforge.org
   http://rubyforge.org/mailman/listinfo/camping-list
  
  
   ___
   Camping-list mailing list
   Camping-list@rubyforge.org
   http://rubyforge.org/mailman/listinfo/camping-list
  
 
 
 
  --
  Dave
  ___
  Camping-list mailing list
  Camping-list@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
 
  ___
  Camping-list mailing list
  Camping-list@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 



 --
 Dave
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list


 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: sending a post request from a controller

2011-07-03 Thread David Susco
They do not, pretty much they need a few input tags and that's about
it. I'm just looking to do my form validation/preparation server-side
instead of client-side.

Dave

On Sun, Jul 3, 2011 at 9:35 PM, John Beppu john.be...@gmail.com wrote:
 Does Sallie Mae provide a payment processing API?  I searched for it, but I
 couldn't find anything.

 On Sun, Jul 3, 2011 at 4:46 AM, David Susco dsu...@gmail.com wrote:

 None of those, I'm in education, and we have to go through Sallie Mae.

 Dave

 On Sun, Jul 3, 2011 at 1:16 AM, John Beppu john.be...@gmail.com wrote:
  Can you tell us what payment processing system you're trying to work
  with?
  Is it PayPal or Google Checkout?
  Bitcoin?  ;-)
 
  On Thu, Jun 30, 2011 at 6:48 AM, David Susco dsu...@gmail.com wrote:
 
  Ideally I'd like a user to be able to submit a form to the camping
  app, having camping do all the validation and some preprocessing and
  then have the camping app send the user to an external site (with the
  post data) where the user can complete a payment.
 
  Dave
 
  On Wed, Jun 29, 2011 at 5:00 PM, Steve Klabnik st...@steveklabnik.com
  wrote:
   No, redirects are an HTTP response, they're not a new request.
   Can you give a more concrete example? Your explanation sounds like
   you're
   trying to do two different things, and I'm not sure which you mean.
   ___
   Camping-list mailing list
   Camping-list@rubyforge.org
   http://rubyforge.org/mailman/listinfo/camping-list
  
 
 
 
  --
  Dave
  ___
  Camping-list mailing list
  Camping-list@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
 
  ___
  Camping-list mailing list
  Camping-list@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 



 --
 Dave
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list


 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: sending a post request from a controller

2011-06-30 Thread David Susco
Ideally I'd like a user to be able to submit a form to the camping
app, having camping do all the validation and some preprocessing and
then have the camping app send the user to an external site (with the
post data) where the user can complete a payment.

Dave

On Wed, Jun 29, 2011 at 5:00 PM, Steve Klabnik st...@steveklabnik.com wrote:
 No, redirects are an HTTP response, they're not a new request.
 Can you give a more concrete example? Your explanation sounds like you're
 trying to do two different things, and I'm not sure which you mean.
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


sending a post request from a controller

2011-06-29 Thread David Susco
What's the cleanest way to do this? With Net::HTTP? I have a form
that's sent to a controller and validated. If its valid I'd like to
send the user on (along with the info they've entered) to an external
site to process payment.

Thanks,
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: sending a post request from a controller

2011-06-29 Thread David Susco
Can I send POST data along with a redirect?

Dave

On Wed, Jun 29, 2011 at 3:44 PM, Steve Klabnik st...@steveklabnik.com wrote:
 If you're sending them along, isn't that a redirect, not a POST?
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: anyone run into this activerecord error before?

2011-05-24 Thread David Susco
Apparently its a known issue:

http://webcache.googleusercontent.com/search?q=cache:cS8js8AYQHgJ:https://rails.lighthouseapp.com/projects/8994/tickets/6233

Looks like I get to migrate to has_many :through. :P

Dave

On Tue, May 24, 2011 at 2:49 PM, Jeremy McAnally
jeremymcana...@gmail.com wrote:
 It's likely trying to get the columns or something like that and
 doesn't have a connection to do so.

 --Jeremy

 On Tue, May 24, 2011 at 2:21 PM, Magnus Holm judo...@gmail.com wrote:
 It seems that you need to establish a connection *before* you write
 your models. Doesn't seem to be a way around it :/

 // Magnus Holm

 On Tue, May 24, 2011 at 19:53, David Susco dsu...@gmail.com wrote:
 Not really Camping specific, but I've always had better luck asking on
 this list than any of the rails ones. I'm trying to upgrade from
 activerecord 2.3.8 to 3.0.7 and I'm getting a
 ActiveRecord::ConnectionNotEstablished error when the
 has_and_belongs_to_many association is being used.

 A simple example is attached, and the stack follows. Has anyone run
 into this before?

 !! Error loading /var/www/apps/arg/arg.rb:
 ActiveRecord::ConnectionNotEstablished: 
 ActiveRecord::ConnectionNotEstablished
 /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:317:in
 `retrieve_connection'
 /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/connection_specification.rb:97:in
 `retrieve_connection'
 /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in
 `connection'
 /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/associations.rb:1806:in
 `create_has_and_belongs_to_many_reflection'
 /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/associations.rb:1411:in
 `has_and_belongs_to_many'
 /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/autosave_association.rb:137:in
 `has_and_belongs_to_many'
 /var/www/apps/arg/arg.rb:16:in `class:Assembly'
 /var/www/apps/arg/arg.rb:15:in `module:Models'
 /var/www/apps/arg/arg.rb:14:in `top (required)'
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1/lib/camping/reloader.rb:60:in
 `load'
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1/lib/camping/reloader.rb:60:in
 `load_apps'
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1/lib/camping/reloader.rb:105:in
 `reload!'
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1/lib/camping/reloader.rb:180:in
 `block in reload!'
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1/lib/camping/reloader.rb:179:in
 `each'
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1/lib/camping/reloader.rb:179:in
 `reload!'
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1/lib/camping/reloader.rb:158:in
 `update'
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1/lib/camping/server.rb:157:in
 `find_scripts'
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1/lib/camping/server.rb:161:in
 `reload!'
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1/lib/camping/server.rb:169:in
 `call'
 /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/lint.rb:48:in 
 `_call'
 /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/lint.rb:36:in `call'
 /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/showexceptions.rb:24:in
 `call'
 /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/commonlogger.rb:18:in
 `call'
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1/lib/camping/server.rb:242:in
 `call'
 /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/content_length.rb:13:in
 `call'
 /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/handler/webrick.rb:52:in
 `service'
 /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
 /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
 /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
 !! Error loading /var/www/apps/arg/arg.rb, see backtrace above
 127.0.0.1 - - [24/May/2011 13:45:00] GET / HTTP/1.1 404 45 0.9436

 --
 Dave

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




 --
 http://jeremymcanally.com/ - http://arcturo.com/
 Bowties, ties, and more: http://wickhamhousebrand.com
 My books:
 http://r3uh.com  http://rbip.info/  http://hlrb.org (FREE!)
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: making create environmentally aware

2010-08-24 Thread David Susco
Ya, that's what I'm doing. Just wondering if there was another way to
go about it. I modified your camping-test/base file to call 'create
:test' and specified a test db adapter in my config file to get around
the problem I e-mailed you about.

Dave

On Tue, Aug 24, 2010 at 9:44 AM, Magnus Holm judo...@gmail.com wrote:
 Why don't add this?

  def App.create(env = :development)
  end

 And in production, you can call App.create(:production) yourself.

 // Magnus Holm



 On Tue, Aug 24, 2010 at 15:36, David Susco dsu...@gmail.com wrote:
 Not talking about having it recycle (I assume all Camping apps have a
 small carbon footprint).

 I'm talking about letting the create method know this is the
 dev/test/prod environment and have it load the appropriate database
 connection info etc.

 Any thoughts on this? Having create take an env arguments seems the
 simplest to me.

 --
 Dave
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: two security questions

2010-08-11 Thread David Susco
Ted,

Do you use Camping::Session with Rack::Csrf? If so, how did you get it
to work? Once I include Camping::Session the csrf_token changes every
time I call the method.

Can anyone explain what include Camping::Session is actually doing?

Dave

On Mon, Aug 9, 2010 at 12:22 PM, Ted Kimble t...@tedkimble.com wrote:
 For cross-site request forgery protection I've simply used the
 Rack::Csrf middleware before (http://github.com/baldowl/rack_csrf).
 The github page is pretty self explanatory.

 For Haml, you should just be able to set its :escape_html option to
 true and then

    %p= @something_nasty

 will be escaped by default. See:

 http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#escape_html-option

 for more info.

 Best,
 Ted

 On Mon, Aug 9, 2010 at 9:15 AM, David Susco dsu...@gmail.com wrote:
 Hey guys,

 What do people do to protect against cross-site request forgery? To
 mimic what rails does I was thinking of creating a unique key for each
 session, and then in my logged_in? helper checking if the key passed
 by the user matches the one I set in the session.

 On the second question, I'm using Tilt with Haml templates. Any idea
 how I can set Haml's :escape_html option so each template escapes all
 HTML within variables?

 --
 Dave
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: two security questions

2010-08-10 Thread David Susco
Thanks, that did the trick. Got to comb through my templates now though :P.

On Tue, Aug 10, 2010 at 4:01 PM, Magnus Holm judo...@gmail.com wrote:
 David,

 As far as I remember, this should work:

  module App
    set :haml, { :escape_html = true }
  end

 You set options (as specified in
 http://github.com/rtomayko/tilt/blob/master/TEMPLATES.md) by:

  set :EXTENSION, { :a= true, :b = false }

 // Magnus Holm



 On Mon, Aug 9, 2010 at 19:08, David Susco dsu...@gmail.com wrote:
 Thanks I'll look into the middleware.

 I know that's how you escape HTML in Haml, what am asking though is
 how you set the :escape_html option when all you have is an instance
 of Tilt.

 Dave

 On Mon, Aug 9, 2010 at 12:22 PM, Ted Kimble t...@tedkimble.com wrote:
 For cross-site request forgery protection I've simply used the
 Rack::Csrf middleware before (http://github.com/baldowl/rack_csrf).
 The github page is pretty self explanatory.

 For Haml, you should just be able to set its :escape_html option to
 true and then

    %p= @something_nasty

 will be escaped by default. See:

 http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#escape_html-option

 for more info.

 Best,
 Ted

 On Mon, Aug 9, 2010 at 9:15 AM, David Susco dsu...@gmail.com wrote:
 Hey guys,

 What do people do to protect against cross-site request forgery? To
 mimic what rails does I was thinking of creating a unique key for each
 session, and then in my logged_in? helper checking if the key passed
 by the user matches the one I set in the session.

 On the second question, I'm using Tilt with Haml templates. Any idea
 how I can set Haml's :escape_html option so each template escapes all
 HTML within variables?

 --
 Dave
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




 --
 Dave
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Reloading in a standard config.ru rack app (Camping 2.0)

2010-08-02 Thread David Susco
On a somewhat related note. How do people handle static content in a
development environment? Is there a way to make the camping server
aware of the public/ directory and serve the files within it?

What about in production? Is passenger smart enough to pass requests
for files in public/ back to apache or is some further configuration
required?

Dave

2010/8/1 Omar Gómez omar.go...@gmail.com:
 Worked like a charm,

 Thanks a lot!

 On Sun, Aug 1, 2010 at 7:52 AM,  camping-list-requ...@rubyforge.org wrote:

 Message: 8
 Date: Sun, 01 Aug 2010 06:51:52 -0600
 From: Philippe Monnet r...@monnet-usa.com
 To: camping-list@rubyforge.org
 Subject: Re: Reloading in a standard config.ru rack app (Camping 2.0)
 Message-ID: 4c556de8.3040...@monnet-usa.com
 Content-Type: text/plain; charset=iso-8859-1; Format=flowed

  Hi Omar,

 When I want to test using rackup instead of the Camping server I use the
 following config.ru assuming that myapp.rb has a MyApp module:

 gem 'camping' , '= 2.0'
 %w(rack activerecord camping camping/session camping/reloader ).each { |
 r | require r}
 reloader = Camping::Reloader.new('myapp.rb')
 app = reloader.apps[:MyApp]
 run app

 And when I need to mount static content I also add the following
 statements _before _run app:

 use Rack::Reloader
 use Rack::Static,
     :urls = [ '/css',
                     '/css/images'
                     '/images',
                     '/js' ],
     :root = File.expand_path(File.dirname(__FILE__))

 Note that this only meant for local testing or in your staging
 environment (for example if you need to make a quick change while
 troubleshooting an issue).

 Philippe

 On 7/31/2010 6:12 PM, Omar G?mez wrote:
 Dear Camping ninjas,

 I've been using Camping via bin/camping and reloading works as expected OK.

 What I have not been able to do is to correctly setup a Camping app
 with reloading support in a standard config.ru rack app.

 Thanks for your attention

 --Omar G?mez



 --
 Follow me at:
 Twitter: http://twitter.com/omargomez
 Buzz: http://www.google.com/profiles/108165850309051561506#buzz
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: using Tilt requires full controller reference

2010-07-26 Thread David Susco
Alright I updated camping to .405, did a pristine on Tilt (v1.0.1),
removed the include X from my Base module and my controllers are still
being found (no anonymous modules errors).

Re: your test, I required camping/template and got this:

NameError: uninitialized constant Riki::Base::Template

/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:440:in
`load_missing_constant'

/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in
`const_missing'
(eval):13:in `lookup'
(eval):12:in `fetch'
(eval):12:in `lookup'
(eval):15:in `render'
./riki/controllers.rb:11:in `get'
(eval):28:in `send'
(eval):28:in `service'
(eval):28:in `catch'
(eval):28:in `service'
(eval):39:in `call'

/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/session/cookie.rb:37:in
`call'
(eval):43:in `call'

/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.405/bin/../lib/camping/server.rb:176:in
`call'
/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:47:in 
`_call'
/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:35:in 
`call'

/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/showexceptions.rb:24:in
`call'

/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in
`call'

/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.405/bin/../lib/camping/server.rb:242:in
`call'

/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in
`call'

/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:48:in
`service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'

/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:14:in
`run'
/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:155:in 
`start'

/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.405/bin/../lib/camping/server.rb:144:in
`start'
/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:83:in 
`start'
/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.405/bin/camping:9
/usr/local/bin/camping:19:in `load'
/usr/local/bin/camping:19


On Fri, Jul 23, 2010 at 5:44 PM, Magnus Holm judo...@gmail.com wrote:
 You'll have to agree that include X sounds so much better than
 include Controllers? :-)

 Could you test one more thing for me? Without a Tilt patch, can you
 add `require 'camping/templates'` right after `require 'camping'` and
 check if it still works?

 Here you go: `gem install camping --source http://gems.judofyr.net/`

 // Magnus Holm



 On Fri, Jul 23, 2010 at 21:48, David Susco dsu...@gmail.com wrote:
 lol, at first I thought you were messing with me. X is the apps
 Controllers module, correct?

 Will I always have to do this when using Tilt? Or only until this
 patch makes it into a gem?

 Dave

 On Fri, Jul 23, 2010 at 3:09 PM, Magnus Holm judo...@gmail.com wrote:
 Wait, forget about that Tilt patch. Try this instead:

  module App
    include X
  end

 // Magnus Holm



 On Fri, Jul 23, 2010 at 18:01, David Susco dsu...@gmail.com wrote:
 Hey Magnus, I patched the files and it's still the same thing. Here's
 the backtrace, let me know if you want browser dump as well.

 127.0.0.1 - - [23/Jul/2010 11:48:39] GET /Home HTTP/1.1 500 95353 0.3607
 ArgumentError: Anonymous modules have no name to be referenced by
        
 /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:585:in
 `to_constant_name'
        
 /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:391:in
 `qualified_name_for'
        
 /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:104:in
 `const_missing'
        /var/www/apps/crud/riki/views/layout.haml:23:in `evaluate_source'
        /usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:195:in 
 `evaluate'
        /usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:560:in 
 `evaluate'
        /usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:128:in 
 `render'
        (eval):15:in `render'
        (eval):15:in `render'
        ./riki/controllers.rb:85:in `get'
        (eval):27:in `send'
        (eval):27:in `service

Re: using Tilt requires full controller reference

2010-07-23 Thread David Susco
Hey Magnus, I patched the files and it's still the same thing. Here's
the backtrace, let me know if you want browser dump as well.

127.0.0.1 - - [23/Jul/2010 11:48:39] GET /Home HTTP/1.1 500 95353 0.3607
ArgumentError: Anonymous modules have no name to be referenced by

/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:585:in
`to_constant_name'

/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:391:in
`qualified_name_for'

/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:104:in
`const_missing'
/var/www/apps/crud/riki/views/layout.haml:23:in `evaluate_source'
/usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:195:in 
`evaluate'
/usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:560:in 
`evaluate'
/usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:128:in `render'
(eval):15:in `render'
(eval):15:in `render'
./riki/controllers.rb:85:in `get'
(eval):27:in `send'
(eval):27:in `service'
(eval):27:in `catch'
(eval):27:in `service'
(eval):38:in `call'

/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/session/cookie.rb:37:in
`call'
(eval):42:in `call'

/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:176:in
`call'
/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:47:in 
`_call'
/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:35:in 
`call'

/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/showexceptions.rb:24:in
`call'

/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in
`call'

/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:242:in
`call'

/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in
`call'

/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:48:in
`service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'

/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:14:in
`run'
/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:155:in 
`start'

/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:144:in
`start'
/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:83:in 
`start'
/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/camping:9
/usr/local/bin/camping:19:in `load'
/usr/local/bin/camping:19


On Wed, Jul 21, 2010 at 5:26 PM, Magnus Holm judo...@gmail.com wrote:
 A reference to a controller is also a constant. Everything which
 starts with an uppercase letter is in fact a constant.

 Hm. Could you give me a backtrace? It seems like it's ActiveSupport's
 const_missing or something like that.

 You don't really need to read/understand all those comments in the
 patch. It's all related to the fact that Tilt defines the template as
 a method under the Tilt::CompileSite (which is included in each
 request in Camping) so when you call #render it actually calls a
 method called #_tilt_ajdbakjasjdbakjsbdk in the background. Calling a
 method is way faster than instance_eval, so this gives a significant
 speed improvement. The problem by defining the method under
 Tilt::CompileSite is that constant lookup is now relative to
 Tilt::CompileSite instead of your request. This is what the patch
 fixes.

 // Magnus Holm



 On Wed, Jul 21, 2010 at 22:53, David Susco dsu...@gmail.com wrote:
 Thanks Magnus,

 I gave that a shot but I'm still getting an argument error:

 Anonymous modules have no name to be referenced by

 I'm trying to wrap my mind around what this patch is doing, but I
 don't see the connection between constants and a reference to a
 controller.

 Dave

 On Wed, Jul 21, 2010 at 3:29 PM, Magnus Holm judo...@gmail.com wrote:
 This is a well-known bug in Tilt:
 http://groups.google.com/group/tiltrb/browse_thread/thread/19fef5370c4d417f

 The thread includes a quite simple patch for 1.8, and a larger, very
 hackish patch for 1.8+1.9.


 // Magnus Holm



 On Wed, Jul 21, 2010 at 21:05, David Susco dsu...@gmail.com wrote:
 When using Tilt for views I need to completely specify

Re: using Tilt requires full controller reference

2010-07-23 Thread David Susco
lol, at first I thought you were messing with me. X is the apps
Controllers module, correct?

Will I always have to do this when using Tilt? Or only until this
patch makes it into a gem?

Dave

On Fri, Jul 23, 2010 at 3:09 PM, Magnus Holm judo...@gmail.com wrote:
 Wait, forget about that Tilt patch. Try this instead:

  module App
    include X
  end

 // Magnus Holm



 On Fri, Jul 23, 2010 at 18:01, David Susco dsu...@gmail.com wrote:
 Hey Magnus, I patched the files and it's still the same thing. Here's
 the backtrace, let me know if you want browser dump as well.

 127.0.0.1 - - [23/Jul/2010 11:48:39] GET /Home HTTP/1.1 500 95353 0.3607
 ArgumentError: Anonymous modules have no name to be referenced by
        
 /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:585:in
 `to_constant_name'
        
 /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:391:in
 `qualified_name_for'
        
 /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:104:in
 `const_missing'
        /var/www/apps/crud/riki/views/layout.haml:23:in `evaluate_source'
        /usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:195:in 
 `evaluate'
        /usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:560:in 
 `evaluate'
        /usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:128:in 
 `render'
        (eval):15:in `render'
        (eval):15:in `render'
        ./riki/controllers.rb:85:in `get'
        (eval):27:in `send'
        (eval):27:in `service'
        (eval):27:in `catch'
        (eval):27:in `service'
        (eval):38:in `call'
        
 /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/session/cookie.rb:37:in
 `call'
        (eval):42:in `call'
        
 /usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:176:in
 `call'
        /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:47:in 
 `_call'
        /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:35:in 
 `call'
        
 /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/showexceptions.rb:24:in
 `call'
        
 /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in
 `call'
        
 /usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:242:in
 `call'
        
 /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in
 `call'
        
 /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:48:in
 `service'
        /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
        /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
        /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
        /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
        /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
        /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
        /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
        /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
        /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
        /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'
        
 /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:14:in
 `run'
        
 /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:155:in 
 `start'
        
 /usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:144:in
 `start'
        /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:83:in 
 `start'
        /usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/camping:9
        /usr/local/bin/camping:19:in `load'
        /usr/local/bin/camping:19


 On Wed, Jul 21, 2010 at 5:26 PM, Magnus Holm judo...@gmail.com wrote:
 A reference to a controller is also a constant. Everything which
 starts with an uppercase letter is in fact a constant.

 Hm. Could you give me a backtrace? It seems like it's ActiveSupport's
 const_missing or something like that.

 You don't really need to read/understand all those comments in the
 patch. It's all related to the fact that Tilt defines the template as
 a method under the Tilt::CompileSite (which is included in each
 request in Camping) so when you call #render it actually calls a
 method called #_tilt_ajdbakjasjdbakjsbdk in the background. Calling a
 method is way faster than instance_eval, so this gives a significant
 speed improvement. The problem by defining the method under
 Tilt::CompileSite is that constant lookup is now relative to
 Tilt::CompileSite instead of your request. This is what the patch
 fixes.

 // Magnus Holm



 On Wed, Jul 21, 2010 at 22:53, David Susco dsu...@gmail.com wrote:
 Thanks Magnus,

 I gave that a shot but I'm still getting an argument error:

 Anonymous modules have no name to be referenced by

 I'm trying to wrap my mind around what this patch is doing, but I
 don't see the connection between

Re: using reststop with tilt

2010-07-10 Thread David Susco
Got a chance to work on this this morning.

First patch worked fine, no problem. The second wasn't working for me
until I remembered you need to separate out a method's name as its own
argument when passing it to another method.

So, from my example above, you need to do this:

render :_button, R(SomeController), 'Some Controller'

The comma after _button is the key.

Anyway, they both worked for me, thanks Magnus.

Dave

On Fri, Jul 9, 2010 at 9:47 PM, David Susco dsu...@gmail.com wrote:
 Thanks Magnus, those changes make sense to me. I can test them out no
 problem, just not until Monday. I'll send out another e-mail then.

 Thanks,
 Dave

 On Fri, Jul 9, 2010 at 5:30 PM, Philippe Monnet r...@monnet-usa.com wrote:
 Yes I think the first patch makes sense to filter out partials from the
 process of applying the layout.
 For the second patch now I get why Dave's parameters were not being used. So
 now your change would send *a . Cool.
 Dave do you want to try that out?
 And then Magnus can go ahead and apply it and maybe also to update the
 official gem.

 On 7/9/2010 2:20 PM, Magnus Holm wrote:

 Should we apply a patch like this?

 diff --git a/lib/camping-unabridged.rb b/lib/camping-unabridged.rb
 index 636ad6f..f3195b3 100644
 --- a/lib/camping-unabridged.rb
 +++ b/lib/camping-unabridged.rb
 @@ -272,7 +272,7 @@ module Camping
      def render(v, o={}, b)
        if t = lookup(v)
          s = (t == true) ? mab{ send(v, b) } : t.render(self,
 o[:locals] || {}, b)
 -        s = render(L, o.merge(L = false)) { s } if o[L] != false 
 lookup(L)
 +        s = render(L, o.merge(L = false)) { s } if v.to_s[0] != ?_
  o[L] != false  lookup(L)
          s
        else
          raise Can't find template #{v}

 Also, currently you can pass arguments to `render`. What about this?

 diff --git a/lib/camping-unabridged.rb b/lib/camping-unabridged.rb
 index 636ad6f..c262757 100644
 --- a/lib/camping-unabridged.rb
 +++ b/lib/camping-unabridged.rb
 @@ -269,9 +269,10 @@ module Camping
      #     end
      #   end
      #
 -    def render(v, o={}, b)
 +    def render(v, *a, b)
        if t = lookup(v)
 -        s = (t == true) ? mab{ send(v, b) } : t.render(self,
 o[:locals] || {}, b)
 +        o = a[0] || {}
 +        s = (t == true) ? mab{ send(v, *a, b) } : t.render(self,
 o[:locals] || {}, b)
          s = render(L, o.merge(L = false)) { s } if o[L] != false 
 lookup(L)
          s
        else


 // Magnus Holm



 On Fri, Jul 9, 2010 at 19:12, David Susco dsu...@gmail.com wrote:


 I do have the latest reststop gem, but the problem occurs when I'm
 *not* using reststop. The regular camping render method does not check
 for the _, where as the reststop render does. Line 166 is reststop is
 working, but there's no equivalent logic (that I can see) in camping
 render.

 I've tried calling partials in haml like this without any luck:

 =render :_button R(SomeController) 'Some Controller'
 =render _button R(SomeController) 'Some Controller'

 Dave

 On Fri, Jul 9, 2010 at 12:09 PM, Philippe Monnet r...@monnet-usa.com
 wrote:


 For issue #1: I think I added the change  on line 166( when committing my
 last changes for gem 0.5.3) to check for partials in the normal flow of
 restop_render. Could you verify you have the latest?

 For issue #2: what does your %=render ... % code looks like?
 Is only the name of the partial inside the quotes (e.g. %=render
 _mypartial 123 'arg2' % )? If so the Camping render should be only
 performing the lookup on the partial name (the v argument) and send the
 other arguments along.

 On 7/9/2010 9:14 AM, David Susco wrote:

 FYI, when not using reststop, calling render :_some_partial from a
 template will automatically wrap the partial in the layout.

 I think this is because the render method automatically wraps a view
 in the layout if the layout exists, rather than checking if the first
 character is an underscore and then wrapping the view in the layout if
 this is not the case (like the basic_render method from reststop).

 Another thing that is not possibly when using Tilt (whether using
 reststop or not) is calling a partial that takes arguments. For
 instance, I have a Markaby partial for a button:

   def _button href, text='Cancel'
     a.button text, :href=href
   end

 I can call that from other Markaby views with:

 _button R(SomeController), 'Some Controller'

 But I can't call render on that method because the camping lookup
 method will try to turn the entire render argument into a symbol. It's
 trying to lookup a method _button R(SomeController), 'Some
 Controller' rather than a method _button with the arguments
 R(SomeController), 'Some Controller'.

 Hopefully that was clear enough.

 Dave

 On Fri, Jul 9, 2010 at 9:10 AM, David Susco dsu...@gmail.com wrote:


 Arg, I new it would be something simple. Thanks.

 Dave

 On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnet r...@monnet-usa.com
 wrote:


 David,

 If you're using Tilt, to make partials work in ERB or HAML you

Re: using reststop with tilt

2010-07-09 Thread David Susco
Arg, I new it would be something simple. Thanks.

Dave

On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnet r...@monnet-usa.com wrote:
 David,

 If you're using Tilt, to make partials work in ERB or HAML you would need to
 explicitly call render with the name of the partial. So for example, in ERB:
     %=render _mypartial %

 Philippe (@techarch)

 On 7/8/2010 2:19 PM, David Susco wrote:

 Thanks Philippe, it's working great.

 Has anyone gotten partials to work with Tilt?

 Dave

 On Wed, Jul 7, 2010 at 9:58 PM, Philippe Monnet r...@monnet-usa.com wrote:


 I fixed the issue in the basic_render method. At the time I worked on
 RESTstop I had done the minimum needed to make it work with the new version
 of Camping. And when Tilt support was added I did not fully retrofit the
 code to make it work with Tilt templates. Problem corrected!
 Thanks David for helping us make the implementation more robust.

 I have also published a new 0.5.3 version of the gem.

 Philippe (@techarch)

 On 7/6/2010 10:07 PM, Philippe Monnet wrote:

 Hi David, I will look into this (probably this week-end though) - as I
 actually did not try Tilt at the same time as RESTstop.

 On 7/6/2010 7:45 AM, David Susco wrote:

 Still fooling around with this, no luck yet. Found some other things though.

 It seems I need to fully qualify controllers as arguments for URL and
 R methods when using Tilt (this is irrespective of whether I'm using
 reststop or not). Is there anything I can do to get around this?

 Also, is there anyway to call partials (markaby or other template
 files) from a template file?

 Dave

 On Wed, Jun 30, 2010 at 9:46 AM, David Susco dsu...@gmail.com wrote:


 I'm trying to use the new Tilt integration with reststop. All the
 aliases and whatnot under Implementing your own service
 (http://wiki.github.com/camping/reststop/) are there and :views has
 been set in the options hash. I tried creating sub-directories in the
 views directory (html, HTML) but I still couldn't get it to work.

 I can get my haml template to display if I get rid of the alias for
 reststop_render. All the other render calls to markaby still work when
 I do this too. However, I'm assuming I'm loosing the second argument
 for render in reststop when I do this.

 Am I missing some other setting/configuration option to get this to
 work with the alias for reststop_render?

 --
 Dave





 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list





 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Wiki vs homepage

2010-07-09 Thread David Susco
I agree to the separation as well. A site that introduces camping with
a simple example/tutorial and that links to a wiki (with more advanced
stuff) and the mailing list is a good way to go about it.

Dave

On Thu, Jul 8, 2010 at 10:20 PM, Philippe Monnet r...@monnet-usa.com wrote:
 Yeah, I agree that it makes sense to have two sites, one to promote Camping
 and one to serve as the official reference. And a wiki would be very
 convenient for that.

 On 7/8/2010 1:55 PM, Magnus Holm wrote:

 Hey guys,

 Philippe had some interesting points about the website:

 1. Keep the home page simple with all content fitting within 1280 x 1024
 2. Use a catchy design (need some help here)
 3. Accentuate that Camping is about Ruby (maybe also include the ruby
 logo somewhere)
 4. Have a brief note about the connection to _why and a link to a page
 explaining the history of Camping with further links to _why's other
 sites
 5. Encourage people to try it by capitalizing on some of Camping's
 strengths:
 - Fast to learn - requires only basic Ruby skills
 - Much simpler than Rails but more structure than Sinatra/Padrino
 - Lightning fast and memory efficient allowing fast and efficient sites
 - Can evolve from simple file to organized directory structure
 - Can layer in more features later using persistence and choice of view
 engines
 6. How about using some kind of an animated (auto advancing) slideshow
 to highlight some of the benefits? See an example at:
 http://blog.monnet-usa.com/?p=276
 7. How about a page on learning with a link to the book as well as a
 list of links for other tutorials or short explanations on key topics
 (e.g. how to do migrations, how to use include/extend, how to use
 different view engines, etc.)?
 8. How about a page about plugins with some brief description of their
 intent?
 9. I would love for us to include _why's cartoons in some of the sub pages
 ;-)

 Now, the more I look at this list (and my own thoughts about the new
 camping site) I realize that we're talking about two different things:

 * A site to attract new users
 * A site to inform regular users

 It looks like my attempt (http://whywentcamping.judofyr.net/) tries to
 target the latter, while Philippe targeted the former
 (http://rubycamping.monnet-usa.com/). Both sites serves a purpose and
 I believe both are equally important.

 --

 Here's what I propose: We split the site into two parts. We turn what
 I've created into a wiki. Everyone are welcome to edit and add their
 own content.

 Then we take Philippe's ideas/design/site and turn it into
 ruby-camping.com or whywentcamping.com or whatnot. It probably doesn't
 need to be more than a single page.

 What'd ya think?

 // Magnus Holm
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: using reststop with tilt

2010-07-09 Thread David Susco
FYI, when not using reststop, calling render :_some_partial from a
template will automatically wrap the partial in the layout.

I think this is because the render method automatically wraps a view
in the layout if the layout exists, rather than checking if the first
character is an underscore and then wrapping the view in the layout if
this is not the case (like the basic_render method from reststop).

Another thing that is not possibly when using Tilt (whether using
reststop or not) is calling a partial that takes arguments. For
instance, I have a Markaby partial for a button:

  def _button href, text='Cancel'
a.button text, :href=href
  end

I can call that from other Markaby views with:

_button R(SomeController), 'Some Controller'

But I can't call render on that method because the camping lookup
method will try to turn the entire render argument into a symbol. It's
trying to lookup a method _button R(SomeController), 'Some
Controller' rather than a method _button with the arguments
R(SomeController), 'Some Controller'.

Hopefully that was clear enough.

Dave

On Fri, Jul 9, 2010 at 9:10 AM, David Susco dsu...@gmail.com wrote:
 Arg, I new it would be something simple. Thanks.

 Dave

 On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnet r...@monnet-usa.com wrote:
 David,

 If you're using Tilt, to make partials work in ERB or HAML you would need to
 explicitly call render with the name of the partial. So for example, in ERB:
     %=render _mypartial %

 Philippe (@techarch)

 On 7/8/2010 2:19 PM, David Susco wrote:

 Thanks Philippe, it's working great.

 Has anyone gotten partials to work with Tilt?

 Dave

 On Wed, Jul 7, 2010 at 9:58 PM, Philippe Monnet r...@monnet-usa.com wrote:


 I fixed the issue in the basic_render method. At the time I worked on
 RESTstop I had done the minimum needed to make it work with the new version
 of Camping. And when Tilt support was added I did not fully retrofit the
 code to make it work with Tilt templates. Problem corrected!
 Thanks David for helping us make the implementation more robust.

 I have also published a new 0.5.3 version of the gem.

 Philippe (@techarch)

 On 7/6/2010 10:07 PM, Philippe Monnet wrote:

 Hi David, I will look into this (probably this week-end though) - as I
 actually did not try Tilt at the same time as RESTstop.

 On 7/6/2010 7:45 AM, David Susco wrote:

 Still fooling around with this, no luck yet. Found some other things though.

 It seems I need to fully qualify controllers as arguments for URL and
 R methods when using Tilt (this is irrespective of whether I'm using
 reststop or not). Is there anything I can do to get around this?

 Also, is there anyway to call partials (markaby or other template
 files) from a template file?

 Dave

 On Wed, Jun 30, 2010 at 9:46 AM, David Susco dsu...@gmail.com wrote:


 I'm trying to use the new Tilt integration with reststop. All the
 aliases and whatnot under Implementing your own service
 (http://wiki.github.com/camping/reststop/) are there and :views has
 been set in the options hash. I tried creating sub-directories in the
 views directory (html, HTML) but I still couldn't get it to work.

 I can get my haml template to display if I get rid of the alias for
 reststop_render. All the other render calls to markaby still work when
 I do this too. However, I'm assuming I'm loosing the second argument
 for render in reststop when I do this.

 Am I missing some other setting/configuration option to get this to
 work with the alias for reststop_render?

 --
 Dave





 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list





 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




 --
 Dave




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: using reststop with tilt

2010-07-09 Thread David Susco
I do have the latest reststop gem, but the problem occurs when I'm
*not* using reststop. The regular camping render method does not check
for the _, where as the reststop render does. Line 166 is reststop is
working, but there's no equivalent logic (that I can see) in camping
render.

I've tried calling partials in haml like this without any luck:

=render :_button R(SomeController) 'Some Controller'
=render _button R(SomeController) 'Some Controller'

Dave

On Fri, Jul 9, 2010 at 12:09 PM, Philippe Monnet r...@monnet-usa.com wrote:
 For issue #1: I think I added the change  on line 166( when committing my
 last changes for gem 0.5.3) to check for partials in the normal flow of
 restop_render. Could you verify you have the latest?

 For issue #2: what does your %=render ... % code looks like?
 Is only the name of the partial inside the quotes (e.g. %=render
 _mypartial 123 'arg2' % )? If so the Camping render should be only
 performing the lookup on the partial name (the v argument) and send the
 other arguments along.

 On 7/9/2010 9:14 AM, David Susco wrote:

 FYI, when not using reststop, calling render :_some_partial from a
 template will automatically wrap the partial in the layout.

 I think this is because the render method automatically wraps a view
 in the layout if the layout exists, rather than checking if the first
 character is an underscore and then wrapping the view in the layout if
 this is not the case (like the basic_render method from reststop).

 Another thing that is not possibly when using Tilt (whether using
 reststop or not) is calling a partial that takes arguments. For
 instance, I have a Markaby partial for a button:

   def _button href, text='Cancel'
 a.button text, :href=href
   end

 I can call that from other Markaby views with:

 _button R(SomeController), 'Some Controller'

 But I can't call render on that method because the camping lookup
 method will try to turn the entire render argument into a symbol. It's
 trying to lookup a method _button R(SomeController), 'Some
 Controller' rather than a method _button with the arguments
 R(SomeController), 'Some Controller'.

 Hopefully that was clear enough.

 Dave

 On Fri, Jul 9, 2010 at 9:10 AM, David Susco dsu...@gmail.com wrote:


 Arg, I new it would be something simple. Thanks.

 Dave

 On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnet r...@monnet-usa.com
 wrote:


 David,

 If you're using Tilt, to make partials work in ERB or HAML you would need to
 explicitly call render with the name of the partial. So for example, in ERB:
     %=render _mypartial %

 Philippe (@techarch)

 On 7/8/2010 2:19 PM, David Susco wrote:

 Thanks Philippe, it's working great.

 Has anyone gotten partials to work with Tilt?

 Dave

 On Wed, Jul 7, 2010 at 9:58 PM, Philippe Monnet r...@monnet-usa.com wrote:


 I fixed the issue in the basic_render method. At the time I worked on
 RESTstop I had done the minimum needed to make it work with the new version
 of Camping. And when Tilt support was added I did not fully retrofit the
 code to make it work with Tilt templates. Problem corrected!
 Thanks David for helping us make the implementation more robust.

 I have also published a new 0.5.3 version of the gem.

 Philippe (@techarch)

 On 7/6/2010 10:07 PM, Philippe Monnet wrote:

 Hi David, I will look into this (probably this week-end though) - as I
 actually did not try Tilt at the same time as RESTstop.

 On 7/6/2010 7:45 AM, David Susco wrote:

 Still fooling around with this, no luck yet. Found some other things though.

 It seems I need to fully qualify controllers as arguments for URL and
 R methods when using Tilt (this is irrespective of whether I'm using
 reststop or not). Is there anything I can do to get around this?

 Also, is there anyway to call partials (markaby or other template
 files) from a template file?

 Dave

 On Wed, Jun 30, 2010 at 9:46 AM, David Susco dsu...@gmail.com wrote:


 I'm trying to use the new Tilt integration with reststop. All the
 aliases and whatnot under Implementing your own service
 (http://wiki.github.com/camping/reststop/) are there and :views has
 been set in the options hash. I tried creating sub-directories in the
 views directory (html, HTML) but I still couldn't get it to work.

 I can get my haml template to display if I get rid of the alias for
 reststop_render. All the other render calls to markaby still work when
 I do this too. However, I'm assuming I'm loosing the second argument
 for render in reststop when I do this.

 Am I missing some other setting/configuration option to get this to
 work with the alias for reststop_render?

 --
 Dave





 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

Re: using reststop with tilt

2010-07-09 Thread David Susco
Thanks Magnus, those changes make sense to me. I can test them out no
problem, just not until Monday. I'll send out another e-mail then.

Thanks,
Dave

On Fri, Jul 9, 2010 at 5:30 PM, Philippe Monnet r...@monnet-usa.com wrote:
 Yes I think the first patch makes sense to filter out partials from the
 process of applying the layout.
 For the second patch now I get why Dave's parameters were not being used. So
 now your change would send *a . Cool.
 Dave do you want to try that out?
 And then Magnus can go ahead and apply it and maybe also to update the
 official gem.

 On 7/9/2010 2:20 PM, Magnus Holm wrote:

 Should we apply a patch like this?

 diff --git a/lib/camping-unabridged.rb b/lib/camping-unabridged.rb
 index 636ad6f..f3195b3 100644
 --- a/lib/camping-unabridged.rb
 +++ b/lib/camping-unabridged.rb
 @@ -272,7 +272,7 @@ module Camping
  def render(v, o={}, b)
if t = lookup(v)
  s = (t == true) ? mab{ send(v, b) } : t.render(self,
 o[:locals] || {}, b)
 -s = render(L, o.merge(L = false)) { s } if o[L] != false 
 lookup(L)
 +s = render(L, o.merge(L = false)) { s } if v.to_s[0] != ?_
  o[L] != false  lookup(L)
  s
else
  raise Can't find template #{v}

 Also, currently you can pass arguments to `render`. What about this?

 diff --git a/lib/camping-unabridged.rb b/lib/camping-unabridged.rb
 index 636ad6f..c262757 100644
 --- a/lib/camping-unabridged.rb
 +++ b/lib/camping-unabridged.rb
 @@ -269,9 +269,10 @@ module Camping
  # end
  #   end
  #
 -def render(v, o={}, b)
 +def render(v, *a, b)
if t = lookup(v)
 -s = (t == true) ? mab{ send(v, b) } : t.render(self,
 o[:locals] || {}, b)
 +o = a[0] || {}
 +s = (t == true) ? mab{ send(v, *a, b) } : t.render(self,
 o[:locals] || {}, b)
  s = render(L, o.merge(L = false)) { s } if o[L] != false 
 lookup(L)
  s
else


 // Magnus Holm



 On Fri, Jul 9, 2010 at 19:12, David Susco dsu...@gmail.com wrote:


 I do have the latest reststop gem, but the problem occurs when I'm
 *not* using reststop. The regular camping render method does not check
 for the _, where as the reststop render does. Line 166 is reststop is
 working, but there's no equivalent logic (that I can see) in camping
 render.

 I've tried calling partials in haml like this without any luck:

 =render :_button R(SomeController) 'Some Controller'
 =render _button R(SomeController) 'Some Controller'

 Dave

 On Fri, Jul 9, 2010 at 12:09 PM, Philippe Monnet r...@monnet-usa.com
 wrote:


 For issue #1: I think I added the change  on line 166( when committing my
 last changes for gem 0.5.3) to check for partials in the normal flow of
 restop_render. Could you verify you have the latest?

 For issue #2: what does your %=render ... % code looks like?
 Is only the name of the partial inside the quotes (e.g. %=render
 _mypartial 123 'arg2' % )? If so the Camping render should be only
 performing the lookup on the partial name (the v argument) and send the
 other arguments along.

 On 7/9/2010 9:14 AM, David Susco wrote:

 FYI, when not using reststop, calling render :_some_partial from a
 template will automatically wrap the partial in the layout.

 I think this is because the render method automatically wraps a view
 in the layout if the layout exists, rather than checking if the first
 character is an underscore and then wrapping the view in the layout if
 this is not the case (like the basic_render method from reststop).

 Another thing that is not possibly when using Tilt (whether using
 reststop or not) is calling a partial that takes arguments. For
 instance, I have a Markaby partial for a button:

   def _button href, text='Cancel'
     a.button text, :href=href
   end

 I can call that from other Markaby views with:

 _button R(SomeController), 'Some Controller'

 But I can't call render on that method because the camping lookup
 method will try to turn the entire render argument into a symbol. It's
 trying to lookup a method _button R(SomeController), 'Some
 Controller' rather than a method _button with the arguments
 R(SomeController), 'Some Controller'.

 Hopefully that was clear enough.

 Dave

 On Fri, Jul 9, 2010 at 9:10 AM, David Susco dsu...@gmail.com wrote:


 Arg, I new it would be something simple. Thanks.

 Dave

 On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnet r...@monnet-usa.com
 wrote:


 David,

 If you're using Tilt, to make partials work in ERB or HAML you would need to
 explicitly call render with the name of the partial. So for example, in ERB:
     %=render _mypartial %

 Philippe (@techarch)

 On 7/8/2010 2:19 PM, David Susco wrote:

 Thanks Philippe, it's working great.

 Has anyone gotten partials to work with Tilt?

 Dave

 On Wed, Jul 7, 2010 at 9:58 PM, Philippe Monnet r...@monnet-usa.com wrote:


 I fixed the issue in the basic_render method. At the time I worked on
 RESTstop I had done the minimum needed to make it work with the new

Re: using reststop with tilt

2010-07-08 Thread David Susco
Thanks Philippe, it's working great.

Has anyone gotten partials to work with Tilt?

Dave

On Wed, Jul 7, 2010 at 9:58 PM, Philippe Monnet r...@monnet-usa.com wrote:
 I fixed the issue in the basic_render method. At the time I worked on
 RESTstop I had done the minimum needed to make it work with the new version
 of Camping. And when Tilt support was added I did not fully retrofit the
 code to make it work with Tilt templates. Problem corrected!
 Thanks David for helping us make the implementation more robust.

 I have also published a new 0.5.3 version of the gem.

 Philippe (@techarch)

 On 7/6/2010 10:07 PM, Philippe Monnet wrote:

 Hi David, I will look into this (probably this week-end though) - as I
 actually did not try Tilt at the same time as RESTstop.

 On 7/6/2010 7:45 AM, David Susco wrote:

 Still fooling around with this, no luck yet. Found some other things though.

 It seems I need to fully qualify controllers as arguments for URL and
 R methods when using Tilt (this is irrespective of whether I'm using
 reststop or not). Is there anything I can do to get around this?

 Also, is there anyway to call partials (markaby or other template
 files) from a template file?

 Dave

 On Wed, Jun 30, 2010 at 9:46 AM, David Susco dsu...@gmail.com wrote:


 I'm trying to use the new Tilt integration with reststop. All the
 aliases and whatnot under Implementing your own service
 (http://wiki.github.com/camping/reststop/) are there and :views has
 been set in the options hash. I tried creating sub-directories in the
 views directory (html, HTML) but I still couldn't get it to work.

 I can get my haml template to display if I get rid of the alias for
 reststop_render. All the other render calls to markaby still work when
 I do this too. However, I'm assuming I'm loosing the second argument
 for render in reststop when I do this.

 Am I missing some other setting/configuration option to get this to
 work with the alias for reststop_render?

 --
 Dave





 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: using reststop with tilt

2010-07-06 Thread David Susco
Still fooling around with this, no luck yet. Found some other things though.

It seems I need to fully qualify controllers as arguments for URL and
R methods when using Tilt (this is irrespective of whether I'm using
reststop or not). Is there anything I can do to get around this?

Also, is there anyway to call partials (markaby or other template
files) from a template file?

Dave

On Wed, Jun 30, 2010 at 9:46 AM, David Susco dsu...@gmail.com wrote:
 I'm trying to use the new Tilt integration with reststop. All the
 aliases and whatnot under Implementing your own service
 (http://wiki.github.com/camping/reststop/) are there and :views has
 been set in the options hash. I tried creating sub-directories in the
 views directory (html, HTML) but I still couldn't get it to work.

 I can get my haml template to display if I get rid of the alias for
 reststop_render. All the other render calls to markaby still work when
 I do this too. However, I'm assuming I'm loosing the second argument
 for render in reststop when I do this.

 Am I missing some other setting/configuration option to get this to
 work with the alias for reststop_render?

 --
 Dave




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


using reststop with tilt

2010-06-30 Thread David Susco
I'm trying to use the new Tilt integration with reststop. All the
aliases and whatnot under Implementing your own service
(http://wiki.github.com/camping/reststop/) are there and :views has
been set in the options hash. I tried creating sub-directories in the
views directory (html, HTML) but I still couldn't get it to work.

I can get my haml template to display if I get rid of the alias for
reststop_render. All the other render calls to markaby still work when
I do this too. However, I'm assuming I'm loosing the second argument
for render in reststop when I do this.

Am I missing some other setting/configuration option to get this to
work with the alias for reststop_render?

-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


versioning alternatives

2010-06-29 Thread David Susco
Has anyone had any experience with vestal_versions, has_versioning, or
another similar gem with camping?

I'm currently fooling around with vestal_versions ( :P ) trying to
figure out how to create the version table. Apparently this is handled
via a script/db migration in Rails, and without something similar to
the handy create_versioned_table call that's in acts_as_versioned.

-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: First time on Camping

2010-06-08 Thread David Susco
Camping with reststop ought will make serving the xml files easy
enough. The example on github ought to get you started:

http://github.com/camping/reststop

Dave

On Tue, Jun 8, 2010 at 2:25 AM, Raimon Fernandez co...@montx.com wrote:
 hi list,


 This is my first time here, my first time reading seriously something about 
 Camping.

 I need to create a very simple web server for serving only .xml files, 
 extracted from a sqlite database with some queries.

 I'm quite comfortable with Ruby on Rails, but it would be too much for this 
 project, so I've decided to take a look at Camping or Sinatra, not sure 
 what's the best option.

 There would be only 5 tables, 100 rows per table, and the idea is fetch data 
 from a device like iPad/iPhone/iPod, update it and persist the changes in the 
 server. The data transfer would be in plain .xml files, no html or css.

 Any helpful directions would be great

 :-)

 thanks,

 r.
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: First time on Camping

2010-06-08 Thread David Susco
I don't believe the gem has been updated to include Matt's or
Philippe's latest changes. You could clone it from GitHub though and
rake and install it yourself.

Dave

On Tue, Jun 8, 2010 at 11:55 AM, Raimon Fernandez co...@montx.com wrote:
 Hi Dave,

 On 8jun, 2010, at 17:04 , David Susco wrote:

 Camping with reststop ought will make serving the xml files easy
 enough. The example on github ought to get you started:

 http://github.com/camping/reststop

 thanks !

 reststop is also a gem for camping ?

 regards,



 r.



 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: First time on Camping

2010-06-08 Thread David Susco
Is the hoe gem installed?

Dave

On Tue, Jun 8, 2010 at 1:01 PM, Raimon Fernandez co...@montx.com wrote:

 On 8jun, 2010, at 18:43 , David Susco wrote:

 I don't believe the gem has been updated to include Matt's or
 Philippe's latest changes. You could clone it from GitHub though and
 rake and install it yourself.

 I think it requieres 'hoe' and I can't install without rubygems working or 
 once again, find where the repo is and start digging again ...

 :-)

 MacBook-ProII-2:reststop montx$ sudo rake Rakefile
 (in /Users/montx/Documents/Camping/reststop)
 rake aborted!
 no such file to load -- hoe
 /Users/montx/Documents/Camping/reststop/rakefile:10


 thanks!

 r.
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: [ANN] Camping 2.0 - minature rails for stay-at-home moms

2010-04-09 Thread David Susco
Indeed, congratulations everyone. And thank you to all those who made
the 199 commits.

On Fri, Apr 9, 2010 at 12:14 PM, John Beppu john.be...@gmail.com wrote:
 Good job.

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Camping 2.0.RC0

2010-04-05 Thread David Susco
No hiccups with my apps.

Dave

On Sat, Apr 3, 2010 at 4:23 PM, Magnus Holm judo...@gmail.com wrote:
 Ladies and gentlemen:
     gem install camping --prerelease
 (Look, no --source!)
 I'm not a big fan of betas/RCs, but this is a rather big change and I want
 to make sure we release something that actually works. I don't have any apps
 that runs on Camping (neither 1.5 nor 1.9/2.0), so I was hoping if some of
 you could verify that it works as expected?
 I'll give it a week or so, and if everything seems fine I'll…
 * Copy the documentation at http://stuff.judofyr.net/camping-docs/ to
 http://camping.rubyforge.org/
 * Make sure all the links in the wiki points to the right place
 * Release the gem as 2.0 at rubygems.org
 * Write an announcement which I'll post to ruby-core, rack-devel and
 camping-list
 * Submit the announcement to Rubyflow and ruby.reddit
 * Write a patch which removes Rack::Adapters::Camping from Rack
 * (Possibly write a little blog post comparing Camping and Sinatra from an
 objective point of view)
 * Start hacking on Camping 2.1!
 Puh. What'd ya think?
 Oh, and busbey has been playing a bit with the
 code: http://github.com/busbey/camping. Some awesome migrations ideas in
 there. Looking forward to merge them into 2.1!

 // Magnus Holm

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


going into production, a few questions

2010-02-19 Thread David Susco
I have a few camping projects that are about to go into production in
a few weeks, just picking your brains to see if I can add some
robustness.

What's the best way to catch any Camping Problem! /XXX not found
errors that a user might see if they start typing URLs themselves?
Ideally I'd just like to redirect them all to some general index
controller.

I'm using MySQL for my database. I'm getting a few MySQL server has
gone away error messages every now and then. I did some searching and
found if reconnect: true is in the hash I send to
establish_connection that I should be all set. Can anyone confirm?
Also, any other MySQL connection best practices that I should be
following?

-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: going into production, a few questions

2010-02-19 Thread David Susco
Thanks on the 404 stuff, that was easy.

I'm going to stick with the reconnect = true until that is proving
not to work. It's the easiest as it's a one liner addition to my yaml.

Dave

On Fri, Feb 19, 2010 at 3:13 PM, Magnus Holm judo...@gmail.com wrote:
 404 on 1.5:
 module App::Controllers
   class NotFound
     def get(path)
       Do something with path
     end
   end
 end
 404 on 1.9/2.0:
 module App
   def r404(path)
     Do something with path
   end
 end
 There appears to be two solutions:
 Call ActiveRecord::Base.verify_active_connections! before every request (I
 think this is what Rails does by default):
 module VerifyConnection
   def service(*args)
     ActiveRecord::Base.verify_active_connections!
   ensure
     return super
   end
 end
 module App
   include VerifyConnection
 end
 Or, pass reconnect = true to establish_connection.
 I'm not quite sure what's best…
 // Magnus Holm


 On Fri, Feb 19, 2010 at 20:59, David Susco dsu...@gmail.com wrote:

 I have a few camping projects that are about to go into production in
 a few weeks, just picking your brains to see if I can add some
 robustness.

 What's the best way to catch any Camping Problem! /XXX not found
 errors that a user might see if they start typing URLs themselves?
 Ideally I'd just like to redirect them all to some general index
 controller.

 I'm using MySQL for my database. I'm getting a few MySQL server has
 gone away error messages every now and then. I did some searching and
 found if reconnect: true is in the hash I send to
 establish_connection that I should be all set. Can anyone confirm?
 Also, any other MySQL connection best practices that I should be
 following?

 --
 Dave
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list


 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Camping tutorials for education?

2009-06-11 Thread David Susco
Scratch that, got everything working with 1.8.7-p173 and selinux
disabled. I have to say, rack apps are pretty easy to deploy with
passenger once you get the thing installed and working :P.

@Jonathan - Re: your apache conf, I actually didn't need the directory
directive and the execcgi option to get this to work. Why did you list
it?

So here's my TODO list:

1. Try to get it working with selinux enabled.
2. Put together a tutorial for the wiki (which one would you guys like
to see it on? github?)
3. Look into performance and security. Would installing fastcgi or
something similar speed passenger up any?

On Wed, Jun 10, 2009 at 8:45 PM, David Suscodsu...@gmail.com wrote:
 OK, good to know. What the latest version I can use?

 Dave

 On Wed, Jun 10, 2009 at 5:46 PM, Magnus Holmjudo...@gmail.com wrote:
 Unfornately, Camping doesn't (yet) work on Ruby 1.9.1. Unless someone else want to try
 now, I'm going to have a look at it *after* 2.0 is released.

 //Magnus Holm


 On Wed, Jun 10, 2009 at 22:30, David Susco dsu...@gmail.com wrote:

 I've disabled SELinux to see if I could get any farther.

 I managed to get passenger installed and working, however a fancy
 passenger generated page is telling me the app couldn't be started due
 to this error:

 `require':
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-1.9.316/lib/camping.rb:11:
 syntax error, unexpected tLABEL (SyntaxError)
 p[0]==?/?...@root+p:p end;def URL c='/',*a;c=R(c,...

 It's the same thing when I try to rackup the .ru file, and the same
 when I try to execute this little bit of code:

 #!/usr/bin/env ruby -rubygems
 gem 'camping', '=1.9.316'
 %w(rack camping).each { |lib| require lib }
 puts 'done'

 I'm tried reinstalled camping 1.9.316 but that didn't change anything.
 Any ideas?

 Dave

 On Wed, Jun 10, 2009 at 10:39 AM, David Suscodsu...@gmail.com wrote:
  I'm trying to get passenger working presently, once I do I'll let you
  know how the rest of it goes.
 
  When I try to load the module in the apache conf I get the following
  error:
 
  Cannot load
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
  into server:
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so:
  failed to map segment from shared object: Permission denied
 
  I'm assuming it's an SELinux problem, has anyone run into it before?
  I've done the following already, so it hasn't helped:
 
  http://www.modrails.com/documentation/Users%20guide.html#_the_apache_error_log_says_that_the_spawn_manager_script_does_not_exist_or_that_it_does_not_have_permission_to_execute_it
 
  Dave
 
 
  On Tue, Jun 9, 2009 at 11:28 AM, Jonathan Grollli...@groll.co.za
  wrote:
  Hi David,
 
  On Tue, Jun 09, 2009 at 09:29:22AM -0400, David Susco wrote:
 
  I'd definitely be interested in seeing any work you do with this.
  Having it up on the wiki would be nice too.
 
  I'm still trying to figure out deployment with camping 1.5. I've
  experimented with 1.9.316 and rack but have yet to get an app to work
  with that. The same with Picnic.
 
  Been meaning to write a quick overview of how I did it for you (as
  documentation is super sparse still). Briefly:
 
  (1) Read the passenger user guide at:
  http://www.modrails.com/documentation/Users%20guide.html
 
  I installed passenger from a gem but see the user's guide if you need
  to install on debian using apt (it is in the Ubuntu repositories
  already).
  Similarly rack is from a gem, and I use the same version of camping as
  you (from Judofyr's gem server).
 
  (2) Try and get the hello world from the passenger user guide to
  work for you.
 
  (3) Then try and get the blog example working that is shipped with
  camping. Here is a config.ru that works for that:
 
  require 'rubygems'
  require 'rack'
  require 'camping'
  require 'blog'
  Blog::Models::Base.establish_connection :adapter = sqlite3,
  :database = /home/jonathan/.camping.db
  run Blog
 
  Change the database path to one you have on your system. You may need
  something like:
  Blog::Models.create_schema :assume = (Blog::Models::Post.table_exists?
  ?
  1.0 : 0.0)
 
  before run blog if your sqlite database doesn't yet have the schema
  for the blog example.
 
  (4) And the apache config that I used was something like:
 
  Directory /
               Options ExecCGI FollowSymLinks
                  AllowOverride all
                     Allow from all
  /Directory
  VirtualHost *:80
     ServerName www.rackexample.com
     DocumentRoot /var/www/blog/public
  /VirtualHost
 
  You may need to edit your hosts file so that www.rackexample.com
  resolves to your apache server.
 
  (5) Let us know how it goes...
 
  Regards,
  Jonathan
  ___
  Camping-list mailing list
  Camping-list@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
 
 
 
  --
  Dave
 



 --
 Dave
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http

Re: Camping tutorials for education?

2009-06-10 Thread David Susco
I'm trying to get passenger working presently, once I do I'll let you
know how the rest of it goes.

When I try to load the module in the apache conf I get the following error:

Cannot load 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
into server: 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so:
failed to map segment from shared object: Permission denied

I'm assuming it's an SELinux problem, has anyone run into it before?
I've done the following already, so it hasn't helped:
http://www.modrails.com/documentation/Users%20guide.html#_the_apache_error_log_says_that_the_spawn_manager_script_does_not_exist_or_that_it_does_not_have_permission_to_execute_it

Dave


On Tue, Jun 9, 2009 at 11:28 AM, Jonathan Grollli...@groll.co.za wrote:
 Hi David,

 On Tue, Jun 09, 2009 at 09:29:22AM -0400, David Susco wrote:

 I'd definitely be interested in seeing any work you do with this.
 Having it up on the wiki would be nice too.

 I'm still trying to figure out deployment with camping 1.5. I've
 experimented with 1.9.316 and rack but have yet to get an app to work
 with that. The same with Picnic.

 Been meaning to write a quick overview of how I did it for you (as
 documentation is super sparse still). Briefly:

 (1) Read the passenger user guide at:
 http://www.modrails.com/documentation/Users%20guide.html

 I installed passenger from a gem but see the user's guide if you need
 to install on debian using apt (it is in the Ubuntu repositories already).
 Similarly rack is from a gem, and I use the same version of camping as
 you (from Judofyr's gem server).

 (2) Try and get the hello world from the passenger user guide to
 work for you.

 (3) Then try and get the blog example working that is shipped with
 camping. Here is a config.ru that works for that:

 require 'rubygems'
 require 'rack'
 require 'camping'
 require 'blog'
 Blog::Models::Base.establish_connection :adapter = sqlite3,
 :database = /home/jonathan/.camping.db
 run Blog

 Change the database path to one you have on your system. You may need
 something like:
 Blog::Models.create_schema :assume = (Blog::Models::Post.table_exists? ?
 1.0 : 0.0)

 before run blog if your sqlite database doesn't yet have the schema
 for the blog example.

 (4) And the apache config that I used was something like:

 Directory /
              Options ExecCGI FollowSymLinks
                 AllowOverride all
                    Allow from all
 /Directory
 VirtualHost *:80
    ServerName www.rackexample.com
    DocumentRoot /var/www/blog/public
 /VirtualHost

 You may need to edit your hosts file so that www.rackexample.com
 resolves to your apache server.

 (5) Let us know how it goes...

 Regards,
 Jonathan
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: Camping tutorials for education?

2009-06-10 Thread David Susco
OK, good to know. What the latest version I can use?

Dave

On Wed, Jun 10, 2009 at 5:46 PM, Magnus Holmjudo...@gmail.com wrote:
 Unfornately, Camping doesn't (yet) work on Ruby 1.9.1. Unless someone else want to try
 now, I'm going to have a look at it *after* 2.0 is released.

 //Magnus Holm


 On Wed, Jun 10, 2009 at 22:30, David Susco dsu...@gmail.com wrote:

 I've disabled SELinux to see if I could get any farther.

 I managed to get passenger installed and working, however a fancy
 passenger generated page is telling me the app couldn't be started due
 to this error:

 `require':
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-1.9.316/lib/camping.rb:11:
 syntax error, unexpected tLABEL (SyntaxError)
 p[0]==?/?...@root+p:p end;def URL c='/',*a;c=R(c,...

 It's the same thing when I try to rackup the .ru file, and the same
 when I try to execute this little bit of code:

 #!/usr/bin/env ruby -rubygems
 gem 'camping', '=1.9.316'
 %w(rack camping).each { |lib| require lib }
 puts 'done'

 I'm tried reinstalled camping 1.9.316 but that didn't change anything.
 Any ideas?

 Dave

 On Wed, Jun 10, 2009 at 10:39 AM, David Suscodsu...@gmail.com wrote:
  I'm trying to get passenger working presently, once I do I'll let you
  know how the rest of it goes.
 
  When I try to load the module in the apache conf I get the following
  error:
 
  Cannot load
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
  into server:
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so:
  failed to map segment from shared object: Permission denied
 
  I'm assuming it's an SELinux problem, has anyone run into it before?
  I've done the following already, so it hasn't helped:
 
  http://www.modrails.com/documentation/Users%20guide.html#_the_apache_error_log_says_that_the_spawn_manager_script_does_not_exist_or_that_it_does_not_have_permission_to_execute_it
 
  Dave
 
 
  On Tue, Jun 9, 2009 at 11:28 AM, Jonathan Grollli...@groll.co.za
  wrote:
  Hi David,
 
  On Tue, Jun 09, 2009 at 09:29:22AM -0400, David Susco wrote:
 
  I'd definitely be interested in seeing any work you do with this.
  Having it up on the wiki would be nice too.
 
  I'm still trying to figure out deployment with camping 1.5. I've
  experimented with 1.9.316 and rack but have yet to get an app to work
  with that. The same with Picnic.
 
  Been meaning to write a quick overview of how I did it for you (as
  documentation is super sparse still). Briefly:
 
  (1) Read the passenger user guide at:
  http://www.modrails.com/documentation/Users%20guide.html
 
  I installed passenger from a gem but see the user's guide if you need
  to install on debian using apt (it is in the Ubuntu repositories
  already).
  Similarly rack is from a gem, and I use the same version of camping as
  you (from Judofyr's gem server).
 
  (2) Try and get the hello world from the passenger user guide to
  work for you.
 
  (3) Then try and get the blog example working that is shipped with
  camping. Here is a config.ru that works for that:
 
  require 'rubygems'
  require 'rack'
  require 'camping'
  require 'blog'
  Blog::Models::Base.establish_connection :adapter = sqlite3,
  :database = /home/jonathan/.camping.db
  run Blog
 
  Change the database path to one you have on your system. You may need
  something like:
  Blog::Models.create_schema :assume = (Blog::Models::Post.table_exists?
  ?
  1.0 : 0.0)
 
  before run blog if your sqlite database doesn't yet have the schema
  for the blog example.
 
  (4) And the apache config that I used was something like:
 
  Directory /
               Options ExecCGI FollowSymLinks
                  AllowOverride all
                     Allow from all
  /Directory
  VirtualHost *:80
     ServerName www.rackexample.com
     DocumentRoot /var/www/blog/public
  /VirtualHost
 
  You may need to edit your hosts file so that www.rackexample.com
  resolves to your apache server.
 
  (5) Let us know how it goes...
 
  Regards,
  Jonathan
  ___
  Camping-list mailing list
  Camping-list@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
 
 
 
  --
  Dave
 



 --
 Dave
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list


 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: using ActiveRecord::Validations::ClassMethods

2009-05-22 Thread David Susco
Thanks guys,

That helped get rid of a lot of code.

Dave

On Thu, May 21, 2009 at 10:22 AM, Magnus Holm judo...@gmail.com wrote:
 params is simply Rails' version of @input.
 If you name your keys user[id] and user[name] in the HTML, then
 @input.user should contain a Hash like { 'id' = ..., 'name' = ... } (maybe
 the keys are Symbols; I don't remember at the moment)
 //Magnus Holm


 On Thu, May 21, 2009 at 15:50, David Susco dsu...@gmail.com wrote:

 Thanks, I've gotten it to work.

 On this part though: @user = User.new params[:user

 Is the closing bracket missing? Is params something from Rails that
 allows you to create the user instance variable all in one line
 instead of doing something like this:

 @user = User.new(
  :id = input.id,
  :name = input.name,
  ...
 )

 Can I use it in a camping app relatively easily?

 Dave

 On Wed, May 20, 2009 at 5:27 PM, Eric Mill kproject...@gmail.com wrote:
  In my create actions, I customarily do like
 
  @user = User.new params[:user
  if @user.save
   ...
  else
   ...
  end
 
  But update_attributes should also return true or false, I believe.
 
  On Wed, May 20, 2009 at 4:42 PM, David Susco dsu...@gmail.com wrote:
  So, in my crud controllers, should I be using calls to save instead of
  create and update_attributes? As those just return the object, and not
  true of false based on my validations.
 
  Dave
 
  On Wed, May 20, 2009 at 4:30 PM, Eric Mill kproject...@gmail.com
  wrote:
  Yeah, but in practice, you'd call @user.save, which internally calls
  #valid?, and returns true or false on whether the object was saved or
  not. If the object wasn't saved, @user.errors is populated with the
  error messages.
 
  -- Eric
 
  On Wed, May 20, 2009 at 4:03 PM, Magnus Holm judo...@gmail.com
  wrote:
  I'm a little rusty on AR at the moment, but I think it looks
  something like
  this:
  In the controller:
  if @user.valid?
    # everything is fine
  else
    # ops! @user.errors contains the errors
  end
  //Magnus Holm
 
 
  On Wed, May 20, 2009 at 19:43, David Susco dsu...@gmail.com wrote:
 
  Can ActiveRecord::Validations::ClassMethods be used to provide
  feedback to the user? I noticed the tepee example uses
  validates_uniqueness_of . If the title isn't unique however
  nothing
  is written and the user is never notified.
 
  Does anyone have an example or two of how I could go about informing
  the user that the title they entered was not unique and they need to
  enter another?
 
  --
  Dave
  ___
  Camping-list mailing list
  Camping-list@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
 
  ___
  Camping-list mailing list
  Camping-list@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
  ___
  Camping-list mailing list
  Camping-list@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
 
 
 
  --
  Dave
  ___
  Camping-list mailing list
  Camping-list@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
  ___
  Camping-list mailing list
  Camping-list@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 



 --
 Dave
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list


 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: using ActiveRecord::Validations::ClassMethods

2009-05-21 Thread David Susco
Thanks, I've gotten it to work.

On this part though: @user = User.new params[:user

Is the closing bracket missing? Is params something from Rails that
allows you to create the user instance variable all in one line
instead of doing something like this:

@user = User.new(
  :id = input.id,
  :name = input.name,
  ...
)

Can I use it in a camping app relatively easily?

Dave

On Wed, May 20, 2009 at 5:27 PM, Eric Mill kproject...@gmail.com wrote:
 In my create actions, I customarily do like

 @user = User.new params[:user
 if @user.save
  ...
 else
  ...
 end

 But update_attributes should also return true or false, I believe.

 On Wed, May 20, 2009 at 4:42 PM, David Susco dsu...@gmail.com wrote:
 So, in my crud controllers, should I be using calls to save instead of
 create and update_attributes? As those just return the object, and not
 true of false based on my validations.

 Dave

 On Wed, May 20, 2009 at 4:30 PM, Eric Mill kproject...@gmail.com wrote:
 Yeah, but in practice, you'd call @user.save, which internally calls
 #valid?, and returns true or false on whether the object was saved or
 not. If the object wasn't saved, @user.errors is populated with the
 error messages.

 -- Eric

 On Wed, May 20, 2009 at 4:03 PM, Magnus Holm judo...@gmail.com wrote:
 I'm a little rusty on AR at the moment, but I think it looks something like
 this:
 In the controller:
 if @user.valid?
   # everything is fine
 else
   # ops! @user.errors contains the errors
 end
 //Magnus Holm


 On Wed, May 20, 2009 at 19:43, David Susco dsu...@gmail.com wrote:

 Can ActiveRecord::Validations::ClassMethods be used to provide
 feedback to the user? I noticed the tepee example uses
 validates_uniqueness_of . If the title isn't unique however nothing
 is written and the user is never notified.

 Does anyone have an example or two of how I could go about informing
 the user that the title they entered was not unique and they need to
 enter another?

 --
 Dave
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list


 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




 --
 Dave
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: using redirect with a mongrel server behind apache

2009-05-20 Thread David Susco
I ended up overwriting the redirect method with this:

def redirect *a
  r(302, '', 'Location' = 'my_vhost.net/my_app/' + R(*a).to_s)
end

Thoughts?

Dave

On Tue, May 19, 2009 at 11:05 AM, David Susco dsu...@gmail.com wrote:
 Within an apache vhost I'm rewriting like this:

    IfModule mod_rewrite.c
      RewriteEngine On
      RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
      RewriteRule ^/(.*)$ http://127.0.0.1:5000/$1 [P,QSA,L]
    /IfModule

 I haven't gotten to deployment yet, so I'm not sure if this is what
 I'm actually going to be doing so suggestions are welcome.

 Ideally though (since I'll have multiple camping apps) I'd like to
 have apache forward to many mongrel servers that will be serving up
 the apps.

 Dave

 On Tue, May 19, 2009 at 10:21 AM, Magnus Holm judo...@gmail.com wrote:
 Camping uses the Host-header to figure out where the app is located, and
 Apache *should* carry forward the header to the Mongrel. How have you set
 this up?
 If you're using Camping 1.9 or running this through Rack, you could always
 create a middleware which changes the Host-header:
 class Thing
   def initialize(app, options = {})
    �...@app = app
   end

   def call(env)
    �...@app.call(env.merge({ 'HTTP_HOST' = 'my_vhost.net' }))
   end
 end
 app = Thing.new(app)
 ---
 I also believe Apache is able to modify HTTP-headers.

 //Magnus Holm


 On Tue, May 19, 2009 at 15:31, David Susco dsu...@gmail.com wrote:

 Not sure if this list is still active but I haven't found another yet,
 here's my setup and question.

 * I'm running a camping app using a mongrel server listening at
 127.0.0.1:X.
 * I have a virtual host setup in Apache that is rewriting
 my_vhost.net/my_app/ to 127.0.0.1:X.
 * In one of my controllers I'm trying to redirect to another
 controller like this: redirect Index
 * Instead of being directed to my_vhost.net/my_app/ though the user is
 directed to 127.0.0.1:X.

 What's the best/cleanest way to get around this and have the
 controller redirect to my_vhost.net/my_app/?

 --
 Dave
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list


 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




 --
 Dave




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: using ActiveRecord::Validations::ClassMethods

2009-05-20 Thread David Susco
So, in my crud controllers, should I be using calls to save instead of
create and update_attributes? As those just return the object, and not
true of false based on my validations.

Dave

On Wed, May 20, 2009 at 4:30 PM, Eric Mill kproject...@gmail.com wrote:
 Yeah, but in practice, you'd call @user.save, which internally calls
 #valid?, and returns true or false on whether the object was saved or
 not. If the object wasn't saved, @user.errors is populated with the
 error messages.

 -- Eric

 On Wed, May 20, 2009 at 4:03 PM, Magnus Holm judo...@gmail.com wrote:
 I'm a little rusty on AR at the moment, but I think it looks something like
 this:
 In the controller:
 if @user.valid?
   # everything is fine
 else
   # ops! @user.errors contains the errors
 end
 //Magnus Holm


 On Wed, May 20, 2009 at 19:43, David Susco dsu...@gmail.com wrote:

 Can ActiveRecord::Validations::ClassMethods be used to provide
 feedback to the user? I noticed the tepee example uses
 validates_uniqueness_of . If the title isn't unique however nothing
 is written and the user is never notified.

 Does anyone have an example or two of how I could go about informing
 the user that the title they entered was not unique and they need to
 enter another?

 --
 Dave
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list


 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: using redirect with a mongrel server behind apache

2009-05-19 Thread David Susco
Within an apache vhost I'm rewriting like this:

IfModule mod_rewrite.c
  RewriteEngine On
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule ^/(.*)$ http://127.0.0.1:5000/$1 [P,QSA,L]
/IfModule

I haven't gotten to deployment yet, so I'm not sure if this is what
I'm actually going to be doing so suggestions are welcome.

Ideally though (since I'll have multiple camping apps) I'd like to
have apache forward to many mongrel servers that will be serving up
the apps.

Dave

On Tue, May 19, 2009 at 10:21 AM, Magnus Holm judo...@gmail.com wrote:
 Camping uses the Host-header to figure out where the app is located, and
 Apache *should* carry forward the header to the Mongrel. How have you set
 this up?
 If you're using Camping 1.9 or running this through Rack, you could always
 create a middleware which changes the Host-header:
 class Thing
   def initialize(app, options = {})
    �...@app = app
   end

   def call(env)
    �...@app.call(env.merge({ 'HTTP_HOST' = 'my_vhost.net' }))
   end
 end
 app = Thing.new(app)
 ---
 I also believe Apache is able to modify HTTP-headers.

 //Magnus Holm


 On Tue, May 19, 2009 at 15:31, David Susco dsu...@gmail.com wrote:

 Not sure if this list is still active but I haven't found another yet,
 here's my setup and question.

 * I'm running a camping app using a mongrel server listening at
 127.0.0.1:X.
 * I have a virtual host setup in Apache that is rewriting
 my_vhost.net/my_app/ to 127.0.0.1:X.
 * In one of my controllers I'm trying to redirect to another
 controller like this: redirect Index
 * Instead of being directed to my_vhost.net/my_app/ though the user is
 directed to 127.0.0.1:X.

 What's the best/cleanest way to get around this and have the
 controller redirect to my_vhost.net/my_app/?

 --
 Dave
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list


 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list




-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list