# Camping 1.3, the Microframework

**URL:** <https://www.ruby-forum.com/t/camping-1-3-the-microframework/53518>\
**Category:** Ruby\
**Created:** [February 8, 2006, 6:47am UTC](https://www.ruby-forum.com/t/camping-1-3-the-microframework/53518 "2006-02-08T06:47:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![why\_the\_lucky\_stiff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ac8455/32.png) [@why\_the\_lucky\_stiff](https://www.ruby-forum.com/u/why_the_lucky_stiff)\
**Post date:** [February 8, 2006, 6:47am UTC](https://www.ruby-forum.com/t/camping-1-3-the-microframework/53518/1 "2006-02-08T06:47:39Z")

</div>

Good people of the town: Maybe some of you are interesting in the  
continuing story of Camping. If not, I understand, these are sensitive  
matters, best wishes.

Camping is a small framework designed to mimick Rails, but weighing in  
3.9k. A full explanation can be had at the documentation site:

[http://camping.rubyforge.org/](http://camping.rubyforge.org/)

= New in Camping 1.3 =

If you’ve used previous versions of Camping, I would _highly_ encourage  
you to examine the list of changes below, since this will affect how you  
build Camping apps. To those you who’ve been following development  
gems, there isn’t anything new as of two weeks ago. Who knows, you  
might want to read anyway.

== !^! Warning – ActiveRecord Table Prefixes !^! ==

This is probably the biggest part of Camping which will trip people up.  
Since mounted Camping apps are designed to share a database, I’m using  
table prefixes to prevent name clash.

If you have a model class called Blog::Models::Post, the database name  
will be ‘blog\_post’. The top-level module name is used.

If your model class is in Camping::Models::Post, prefixes won’t be used,  
it’s just ‘post’. The reasoning is: if you’re placing your models right  
in the Camping module, you probably haven’t designed it to play friendly  
with other apps. (See Camping.goes below for more on playing nicely.)

Since table prefixes are used, you’ll also need to use the full table  
name in your IDs:

blog\_post.id =\> blog\_post\_id  
blog\_user.id =\> blog\_user\_id

Unless you set up the `foreign\_key’ property and such properly in the  
models. See

> **[ActiveRecord::Associations::ClassMethods](https://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html)**
>
> Associations are a set of macro-like class methods for tying objects together through foreign keys.

for instructions.

== bin/camping ==

Camping now comes with a launcher. Once your gem is installed, launch  
any Camping application with:

camping your-app.rb

You will need to install SQLite3 and its gem for this to work:  
[http://code.whytheluckystiff.net/camping/wiki/BeAlertWhenOnSqlite3](http://code.whytheluckystiff.net/camping/wiki/BeAlertWhenOnSqlite3)

The database will be stored in ~/.camping.db. On Windows:  
$APPDATA/Camping.db.

== Camping.goes ==

Since you may choose to mount several Camping apps at once and store  
them in a mutual database (for possible cross-pollenation), the  
Camping.goes mechanism will copy the Camping framework into a new module  
for hacking:

require ‘camping’  
Camping.goes :Blog

module Blog::Models … end  
module Blog::Controllers … end  
module Blog::Views … end

== Camping.create ==

Every database-dependant Camping app should have a Camping.create method  
which checks to see if the database tables are created. If not, run the  
schema.

An example on the wiki:  
[http://code.whytheluckystiff.net/camping/wiki/GiveUsTheCreateMethod](http://code.whytheluckystiff.net/camping/wiki/GiveUsTheCreateMethod)

== Camping.run ==

The Camping.run interface is used to interface with the web server.  
Traditional CGI environments can call Camping.run without arguments.  
Web servers which have nice cushiony Ruby extensions can call  
Camping.run with arguments:

controller = Camping.run(request, env)

Examples of working with a bunch of different web servers is in the  
postambles collection:  
[http://code.whytheluckystiff.net/camping/wiki/PostAmbles](http://code.whytheluckystiff.net/camping/wiki/PostAmbles)

== Rails/PHP-style query string ==

The query string: ?post[user]=\_why;post[id]=2

Will be available as a hash at @input.post in your controllers.

module Blog::Controllers  
class Save  
def post  
@post = Post.create(@input.post)  
end  
end  
end

== Luxurious RDoc ==

The RDoc is now a nice multi-page, non-frame RDoc. Try it out:  
[http://camping.rubyforge.org/](http://camping.rubyforge.org/)

= Lastly: Installation =

You may install like so:

gem install camping

Or, if you’d like to follow the bleeding edge gems:

gem install camping --source [code.whytheluckystiff.net](http://code.whytheluckystiff.net)

\_why

---

<div class="post-metadata">

**Author:** ![why\_the\_lucky\_stiff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ac8455/32.png) [@why\_the\_lucky\_stiff](https://www.ruby-forum.com/u/why_the_lucky_stiff)\
**Post date:** [February 8, 2006, 6:56am UTC](https://www.ruby-forum.com/t/camping-1-3-the-microframework/53518/2 "2006-02-08T06:56:58Z")

</div>

Oh and one last thing. There is an indiscriminate mailing list if you  
want:

[http://rubyforge.org/mailman/listinfo/camping-list](http://rubyforge.org/mailman/listinfo/camping-list)

\_why

---

<div class="post-metadata">

**Author:** ![why\_the\_lucky\_stiff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ac8455/32.png) [@why\_the\_lucky\_stiff](https://www.ruby-forum.com/u/why_the_lucky_stiff)\
**Post date:** [February 8, 2006, 6:17pm UTC](https://www.ruby-forum.com/t/camping-1-3-the-microframework/53518/3 "2006-02-08T18:17:46Z")

</div>

On 2/7/06, why the lucky stiff [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> == !^! Warning – ActiveRecord Table Prefixes !^! ==
> 
> This is probably the biggest part of Camping which will trip people up.  
> Since mounted Camping apps are designed to share a database, I’m using  
> table prefixes to prevent name clash.
> 
> If you have a model class called Blog::Models::Post, the database name  
> will be ‘blog\_post’. The top-level module name is used.

Wondering… is that a typo or is it really ‘blog\_post’ instead of  
‘blog\_posts’? The default AR convention is pluralized table names.

Jacob F.

---

<div class="post-metadata">

**Author:** ![why\_the\_lucky\_stiff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ac8455/32.png) [@why\_the\_lucky\_stiff](https://www.ruby-forum.com/u/why_the_lucky_stiff)\
**Post date:** [February 8, 2006, 8:23pm UTC](https://www.ruby-forum.com/t/camping-1-3-the-microframework/53518/4 "2006-02-08T20:23:29Z")

</div>

Hi Jacob,

> Wondering… is that a typo or is it really ‘blog\_post’ instead of  
> ‘blog\_posts’? The default AR convention is pluralized table names.

Is that the AR convention, or is that how AR operates in the context of  
Rails, which uses Inflector to translate all those names back and forth  
for you?

---

<div class="post-metadata">

**Author:** ![why\_the\_lucky\_stiff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ac8455/32.png) [@why\_the\_lucky\_stiff](https://www.ruby-forum.com/u/why_the_lucky_stiff)\
**Post date:** [February 8, 2006, 10:04pm UTC](https://www.ruby-forum.com/t/camping-1-3-the-microframework/53518/5 "2006-02-08T22:04:58Z")

</div>

why the lucky stiff wrote:

> Good people of the town: Maybe some of you are interesting in the  
> continuing story of Camping. If not, I understand, these are sensitive  
> matters, best wishes.

Is ActiveRecord a requirement?

–  
James B.

[http://www.ruby-doc.org](http://www.ruby-doc.org) - Ruby Help & Documentation  
[Ruby Code & Style](http://www.artima.com/rubycs/) - The Journal By & For Rubyists  
[http://www.rubystuff.com](http://www.rubystuff.com) - The Ruby Store for Ruby Stuff  
[http://www.30secondrule.com](http://www.30secondrule.com) - Building Better Tools

---

<div class="post-metadata">

**Author:** ![why\_the\_lucky\_stiff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ac8455/32.png) [@why\_the\_lucky\_stiff](https://www.ruby-forum.com/u/why_the_lucky_stiff)\
**Post date:** [February 8, 2006, 10:15pm UTC](https://www.ruby-forum.com/t/camping-1-3-the-microframework/53518/6 "2006-02-08T22:15:51Z")

</div>

Quoting James B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> why the lucky stiff wrote:
> 
> > Good people of the town: Maybe some of you are interesting in  
> > the continuing story of Camping. If not, I understand, these  
> > are sensitive matters, best wishes.
> 
> Is ActiveRecord a requirement?

No more than it is for Rails.

-mental

---

<div class="post-metadata">

**Author:** ![why\_the\_lucky\_stiff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ac8455/32.png) [@why\_the\_lucky\_stiff](https://www.ruby-forum.com/u/why_the_lucky_stiff)\
**Post date:** [February 9, 2006, 12:11am UTC](https://www.ruby-forum.com/t/camping-1-3-the-microframework/53518/7 "2006-02-09T00:11:19Z")

</div>

removed\_email\_address@domain.invalid wrote:

> No more than it is for Rails.

Ah, I see. It does not include its own persistence lib.

Thanks.

---

<div class="post-metadata">

**Author:** ![why\_the\_lucky\_stiff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ac8455/32.png) [@why\_the\_lucky\_stiff](https://www.ruby-forum.com/u/why_the_lucky_stiff)\
**Post date:** [February 9, 2006, 1:06am UTC](https://www.ruby-forum.com/t/camping-1-3-the-microframework/53518/8 "2006-02-09T01:06:12Z")

</div>

Seth Thomas R. wrote:

> > Wondering… is that a typo or is it really ‘blog\_post’ instead of  
> > ‘blog\_posts’? The default AR convention is pluralized table names.
> 
> Is that the AR convention, or is that how AR operates in the context of  
> Rails, which uses Inflector to translate all those names back and forth  
> for you?

Jacob was right about that typo: it’s `blog\_posts’.

AR convention is to figure out the table names from the class names and  
vice versa. Camping sticks on the `blog\_’ prefix (based on the name of  
the module your app is stored in.)

\_why
