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: mounting multiples app

2013-05-22 Thread David Susco
That will allow you to host two apps via a single config file. To separate
out your MVCs, try this:

-- myapp.rb --

%w(camping).each { |lib| require lib }

Camping.goes :MyApp

%w(helpers models views controllers).each { |lib| require lib }

module MyApp
...
end

-- models.rb --

module MyApp::Models
...
end

-- --

And so on for helpers.rb, views.rb and controllers.rb
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: emails from my camping app

2013-03-28 Thread David Susco
Action Mailer is the most well known. The top three will probably be the
most useful to you:

https://www.google.com/search?q=rails+action+mailer

Dave

On Thu, Mar 28, 2013 at 9:01 AM, Francois Sery wrote:

> Hello,
> i'm looking for a gem to send emails from my camping app.
> Advices and code examples are welcome.Thanks.
>
> François
>
> ___
> 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  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: setting up the SQLite database

2012-05-15 Thread David Susco
1) I usually do 1.3:

def self.connect env
  App::Models::Base.establish_connection App.config[env]['db_connection']
  App::Models::Base.logger = Logger.new File.dirname(__FILE__) +
App.config[env]['db_log']
end

def self.create env = 'dev'
  self.connect env
  self.create_schema
end

2) I've never tried it without specifying the adapter, I figure it
can't hurt to keep it in there. Plus it makes all the env's in my
config file look the same.

3) So long as it's using migrations (the < V /d after the class name)
it won't delete anything by running a connect again after the db has
been created.

class CreateApp < V 1.0
  def self.up
create_table User.table_name do |t|
  t.string :name
  t.timestamps
end
  end

  def self.down
drop_table User.table_name
  end
end

Dave

On Tue, May 15, 2012 at 1:39 PM, Dave Everitt  wrote:
> I know this isn't Python, but I'd like to get a view on the 'one obvious'
> way to set up an SQLite (or other) database and its location per-app. I've
> got a bit lost with the Camping 2 changes and various code snippets I have
> kicking around.
>
> 1.
> is it best to set up the DB creation/connection:
>
> 1.1
> at the end of the app
>
> AppName::Models::Base.establish_connection(
>  :adapter => 'sqlite3',
>  :database => '/path/to/my/app/myApp.db'
> )
> run AppName #from an old snippet
>
> 1.2
> OR
> like this (postgres) example [Magnus]:
>
> def List.create
>  List::Models::Base.establish_connection(
>   :adapter => "postgresql",
>   :username => "root",
>   :password => "toor,
>   :database => "list"
>  )
>  List::Models.create_schema
> end
>
> 1.3
> in a config/database.yml file [Magnus] (probably not worth it for SQLite):
> ---
> adapter: postgresql
> username: root
> password: toor
> database: mycampingdb
>
> And then do:
>
> require 'yaml'
>
> def AppName.create
>  AppName::Models::Base.establish_connection(YAML.load(File.read("database.yml")))
>  AppName::Models.create_schema
> end
>
>
> 2.
> since sqlite is the default, is it necessary to set :adapter explicitly if
> that's what I'm using?
>
> def AppName.create
>  AppName::Models::Base.establish_connection(
>  :adapter => 'sqlite3',
>  :database => '/path/to/my/app/.camping.db'
> )
> end
>
>
> 3.
> Since .create is *only needed once* to set up the database (Magnus: "if you
> connect to a database which already has the tables, DON'T run
> `AppName::Models.create_schema` as this will probably delete the whole
> database.") what do we do with this after the first run:
>
> def AppName.create
>  AppName::Models.create_schema
> end
>
> 3.1 delete it after the db is created on the first run?
> 3.2 check if the db already exists (best way, please)?
> 3.3 check like this (never understood ':assume'?):
> AppName::Models.create_schema :assume => (AppName::Models::
> table_name.table_exists? ? 1.0 : 0.0)
> or could we do something simpler like (?):
> AppName::Models.create_schema unless table_exists?(table_name)
> ?
>
> 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  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  wrote:
>
>> On Fri, Feb 17, 2012 at 22:13, Isak Andersson 
>> 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/mail

Re: Remove "camping app.rb app2.rb" support?

2011-12-20 Thread David Susco
Magnus, would that still support the dynamic reloading of the app file
that the camping server does now?

Dave

On Tue, Dec 20, 2011 at 9:41 AM, Magnus Holm  wrote:
> On Tue, Dec 20, 2011 at 15:14, Isak Andersson  wrote:
>> Den 2011-12-20 14:09:02 skrev David Susco :
>>
>>
>>> I've never found myself working on multiple apps at once in a dev
>>> environment.
>>>
>>> Dave
>>
>>
>> I haven't either, but I can definitely see myself using it sometime.
>
> The new Camping Server will be able to run rackup-files. Would it be
> good enough if you had to do this?
>
>  # in both.ru
>  require 'app'
>  require 'app2'
>  map '/app' do run App end
>  map '/app2' do run App2 end
>
> $ camping both.ru
> ___
> 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: Remove "camping app.rb app2.rb" support?

2011-12-20 Thread David Susco
I've never found myself working on multiple apps at once in a dev environment.

Dave

On Tue, Dec 20, 2011 at 6:14 AM, Magnus Holm  wrote:
> I think the ability to load multiple Camping apps at once makes things
> a lot more difficult (e.g. how to deal with static files).
>
> Does anyone actually use this feature?
>
> // 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: Camping Server: automatically serve static files from public/

2011-12-20 Thread David Susco
Not sure what other people are doing but I already have my apps in
separate folders. Each app has:

app/
app/app.rb
app/app/
app/config/
app/public/
app/lib/
app/db/
app/log/

When I launch a new one I just add it to the apache conf and restart.

Dave

On Tue, Dec 20, 2011 at 6:05 AM, Jenna Fox  wrote:
> I vote number 2 - it keeps apps separated, so you can pop a whole bunch in a
> folder and call it a day - Having one big shared public folder is messy and
> breaks that model of separation entirely. If people like Isak have existing
> arrangements in place, there aught to be some configurable option to specify
> any arbitrary folder as the public files.
>
>
> —
> Jenna Fox
>
> On Tuesday, 20 December 2011 at 9:19 PM, Paul van Tilburg wrote:
>
> On Tue, Dec 20, 2011 at 11:06:09AM +0100, Isak Andersson wrote:
>
> I think Alternative 2 makes the most sense. Then you can have multiple apps
> that don't share the public folder. Plus, you put almost everything in the
> app folder anyways so there shouldn't be a difference now either.
>
> Alternative 2:
>
> app.rb
> app/public
> app/public/style.css # example
>
>
> I disagree. In most cases there is only one app (at least for most of
> my apps). So I have an app.rb with stuff under public/.
>
> If there are more apps, there is no way of knowing whether they are
> designed to work together and share the same public data, or they are
> apps with seperate(d) public data. Since one has to build the URLs in
> the app anyway, why not let the developer decide the layout of public/
> to suit a shared or seperated layout? (One can think of shared
> stylesheets, but different sets of icons/PDFs/whathaveyou).
>
> Kind regards,
> Paul
>
> --
> Web: http://paul.luon.net/home/ | Email: p...@luon.net
> Jabber/GTalk: p...@luon.net | GnuPG key ID: 0x50064181
> ___
> 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 Server: automatically serve static files from public/

2011-12-19 Thread David Susco
#1 gets my vote.

Dave

On Mon, Dec 19, 2011 at 6:24 PM, Philippe Monnet  wrote:
> Plus people familiar with - or switching from ;-) - Rails and other
> frameworks would also feel at home.
>
>
> On 12/19/2011 3:46 PM, Jenna Fox wrote:
>
> Mmm that's true. Lets stick with that.
>
>
> —
> Jenna Fox
>
> On Tuesday, 20 December 2011 at 9:37 AM, Magnus Holm wrote:
>
> On Mon, Dec 19, 2011 at 23:26, Jenna Fox  wrote:
>
> 'public' is a weird word which has special meaning in the context of web
> development for legacy reasons. I think we could find a better word.
> 'Resources', 'web', 'files'?
>
>
> Phusion Passenger uses 'public' to run a Rack-application, so it
> certainly makes things easier if we use the same convention.
> ___
> 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: 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  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: 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  wrote:
> On Mon, Dec 19, 2011 at 21:34, Isak Andersson  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: 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  wrote:
> Here's one useful snippet:
>
>  def (Before="").new(a,*o)Rack::Cascade.new(o<
> 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: run my Camping app as a Rack app

2011-10-09 Thread David Susco
Are you running Apache? Is so, try installing passenger. I've got half
a dozen apps running via this, it makes things pretty easy.

http://www.modrails.com/

Dave

2011/10/9 Bartosz Dziewoński :
> Does it work the "regular" way? (via rackup)
>
> Does it work "your" way, but with a different handler?
>
> Which version of rack you're using? I can't find any usage of tr
> method in 1.3.4's rack/utils.rb, and line 37 of rack/session/cookie.rb
> is a comment.
>
> -- Matma Rex
> ___
> 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  wrote:
> On Wed, Aug 31, 2011 at 1:33 AM, David Susco  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  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: Feature: Simple controllers?

2011-08-25 Thread David Susco
Would you have to write the RE for every declaration?

ie...

 module App::Controllers
   get '/(.*)' do |name|
 "Hello #{name}"
   end

   put '/(.*)' do |name|
 "Hello #{name}"
   end
 end

Dave

On Thu, Aug 25, 2011 at 1:20 PM, Magnus Holm  wrote:
> I just pushed a new feature to Camping: Simple controllers.
>
>  module App::Controllers
>    get '/(.*)' do |name|
>      "Hello #{name}"
>    end
>  end
>
> What do you think? Useful? Or should I revert it? It currently costs
> us 87 bytes.
>
> // 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: 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
 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  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  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  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  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 
>> >> 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 
>> >> > 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
>> >> >> 
>> >> >> 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
>> >&g

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  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  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  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  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 
>> >> 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-07-03 Thread David Susco
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  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  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 
>> 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


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  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


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  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


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: 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
 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  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  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 `'
>>> /var/www/apps/arg/arg.rb:15:in `'
>>> /var/www/apps/arg/arg.rb:14:in `'
>>> /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 4

anyone run into this activerecord error before?

2011-05-24 Thread David Susco
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 `'
/var/www/apps/arg/arg.rb:15:in `'
/var/www/apps/arg/arg.rb:14:in `'
/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


arg.rb
Description: Binary data
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: Strange error with no stack trace

2011-01-20 Thread David Susco
What version of ruby is Heroku running?

Dave

On Thu, Jan 20, 2011 at 12:14 AM, adam moore  wrote:
> Hello there!
>
> Been loving getting stuck in & creating bits & bobs with this
> wonderful little framework. Had a go at making a listing of a bunch of
> opening events which occur in my current city of residence - Tokyo.
> Unfortunately, although the app seemed to be fine running locally (in
> production), once pushed to Heroku I began to see intermittent
> occurrences of:
>
> !! Unexpected error while processing request: undefined method
> `to_sym' for nil:NilClass
>
> just as the app reached rendering the (haml) view.
>
> The problem is, there is no stack trace which is spit out at this
> point - and any puts I have added to the view to check things are ok,
> are never reached. I have a hunch that this may be to do with haml /
> tilt not starting up in time but was wondering if there's a way to
> make production camping apps more "verbose", or if this is needed at
> all.
>
> Thank you all.
>
>
> --
> =^.^=---
> ___
> 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-25 Thread David Susco
The create method is being called before anything I do in my test file though.

Dave

On Tue, Aug 24, 2010 at 11:27 AM, Magnus Holm  wrote:
> What about this:
>
>  def App.create(env = (ENV['CAMPING_ENV'] || :development))
>  end
>
> Then you can simply set ENV['CAMPING_ENV'] = "test" before loading any tests.
>
> // Magnus Holm
>
>
>
> On Tue, Aug 24, 2010 at 16:21, David Susco  wrote:
>> 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  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  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
>>
> ___
> 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  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  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


making create "environmentally aware"

2010-08-24 Thread David Susco
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


Re: Junebug Wiki

2010-08-24 Thread David Susco
Nothing that I know of.

I tried it but never got Junebug to work with 2. I eventually got fed
up enough that I put together my own wiki app by looking at it and
tepee. I used vestal_versions for the versioning and recreated most of
the junebug functionality so far (currently working on diff). It's
also served as my sandbox for all the fun new features that have
rolled out.

Dave

On Tue, Aug 24, 2010 at 8:29 AM, Dave Everitt  wrote:
> Does anyone know if there's a community-maintained version of Julik
> Tarkhanov's Camping-related stuff (e.g. the Camping-based Junebug Wiki
> http://rubyforge.org/projects/junebug/)?
>
> The last update I can find is from 2007, just wondering if anyone's tried it
> with Camping 2.1. Otherwise I'll contact him via Github.
>
> Dave Everitt
>
> ___
> 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  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  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-11 Thread David Susco
Now that looks like a fun climb. =)

Dave

On Tue, Aug 10, 2010 at 5:25 PM, Magnus Holm  wrote:
> Great; sorry for the delay, but I've been here in the last days :-)
>
> http://upload.wikimedia.org/wikipedia/commons/b/bd/Preikestolen_Norge.jpg
>
> // Magnus Holm
>
>
>
> On Tue, Aug 10, 2010 at 22:50, David Susco  wrote:
>> 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  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  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  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  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
>>
> ___
> 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  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  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  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  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: two security questions

2010-08-09 Thread David Susco
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  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  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


two security questions

2010-08-09 Thread David Susco
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


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 :
> Worked like a charm,
>
> Thanks a lot!
>
> On Sun, Aug 1, 2010 at 7:52 AM,   wrote:
>>
>> Message: 8
>> Date: Sun, 01 Aug 2010 06:51:52 -0600
>> From: Philippe Monnet 
>> 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: Multiple inserts in ActiveRecord

2010-07-31 Thread David Susco
That's weird, I can't test anything until Monday but what happens when
you nest it in two ifs?

If @company.valid?
  if @user.valid?
save

On Sat, Jul 31, 2010 at 12:17 PM, Skyler Richter
 wrote:
> @David Susco
>
> I figured that was the way to do it. Thats what I tried the first time
> but I seem to only be able to validate 1 item at a time. It only
> validates the company model and it ignores the "&& @user.valid?" If I
> rearrange my code so that the user gets saved first then only the user
> validates and then it ignores the "&& @company.valid?". Any ideas?
>
> On Sat, Jul 31, 2010 at 6:31 AM, David Susco  wrote:
>> You could check if both the company and user are valid, and if so create 
>> them.
>>
>> @company = Company.new (...)
>> @user = User.new (...)
>>
>> if (@company.valid? and @user.valid?)
>> �...@company.save
>> �...@user.save
>> )
>>
>> Dave
>>
>> On Sat, Jul 31, 2010 at 7:20 AM, Magnus Holm  wrote:
>>> Hey campers,
>>>
>>> I'm wondering if any of you know a better solution to skylerrichter's
>>> problem: http://github.com/camping/camping/issues#issue/28
>>>
>>> The basic idea is that he want to create a Company, and then the first
>>> User in that Company:
>>>
>>>   @company = Company.create(
>>>     :name => @input.name,
>>>     :sub_domain => @input.subdomain)
>>>
>>>   # Create the first user:
>>>   @user = User.create(
>>>     :company_id => @company.id,
>>>     :first_name => @input.first_name,
>>>     :last_name => @input.last_name,
>>>     :email => @input.email,
>>>     :password => @input.password)
>>>
>>> Both Company and User has validations, so there's a possibility that
>>> they don't actually get saved to the DB, and in that case he don't want
>>> *any* of them to be saved (I assume). I was thinking about something like 
>>> this:
>>>
>>>   begin
>>>     Company.transaction do
>>>       @company = Company.create!(
>>>         :name => @input.name,
>>>         :sub_domain => @input.subdomain)
>>>
>>>       @user = User.create!(
>>>         :company_id => @company.id,
>>>         :first_name => @input.first_name,
>>>         :last_name => @input.last_name,
>>>         :email => @input.email,
>>>         :password => @input.password)
>>>     end
>>>   rescue
>>>     @errors = [...@company, @user].compact.map(&:full_messages).flatten
>>>     render :errors
>>>   else
>>>     redirect Login
>>>   end
>>>
>>> But I'm wondering if there's a better way to solve this?
>>>
>>> // 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
>>
> ___
> 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: Multiple inserts in ActiveRecord

2010-07-31 Thread David Susco
You could check if both the company and user are valid, and if so create them.

@company = Company.new (...)
@user = User.new (...)

if (@company.valid? and @user.valid?)
  @company.save
  @user.save
)

Dave

On Sat, Jul 31, 2010 at 7:20 AM, Magnus Holm  wrote:
> Hey campers,
>
> I'm wondering if any of you know a better solution to skylerrichter's
> problem: http://github.com/camping/camping/issues#issue/28
>
> The basic idea is that he want to create a Company, and then the first
> User in that Company:
>
>   @company = Company.create(
>     :name => @input.name,
>     :sub_domain => @input.subdomain)
>
>   # Create the first user:
>   @user = User.create(
>     :company_id => @company.id,
>     :first_name => @input.first_name,
>     :last_name => @input.last_name,
>     :email => @input.email,
>     :password => @input.password)
>
> Both Company and User has validations, so there's a possibility that
> they don't actually get saved to the DB, and in that case he don't want
> *any* of them to be saved (I assume). I was thinking about something like 
> this:
>
>   begin
>     Company.transaction do
>       @company = Company.create!(
>         :name => @input.name,
>         :sub_domain => @input.subdomain)
>
>       @user = User.create!(
>         :company_id => @company.id,
>         :first_name => @input.first_name,
>         :last_name => @input.last_name,
>         :email => @input.email,
>         :password => @input.password)
>     end
>   rescue
>     @errors = [...@company, @user].compact.map(&:full_messages).flatten
>     render :errors
>   else
>     redirect Login
>   end
>
> But I'm wondering if there's a better way to solve this?
>
> // 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: 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  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  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  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  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
>>>

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  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  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  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 t

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  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  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

Re: using Tilt requires full controller reference

2010-07-21 Thread David Susco
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  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  wrote:
>> When using Tilt for views I need to completely specify the controller
>> within the template file.
>>
>> For example, in a Markaby view I can do this:
>>
>> URL(LogIn)
>>
>> But in a template file I have to do this:
>>
>> URL(MyApp::Controllers::LogIn)
>>
>> Is there anyway around this?
>>
>> --
>> 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


using Tilt requires full controller reference

2010-07-21 Thread David Susco
When using Tilt for views I need to completely specify the controller
within the template file.

For example, in a Markaby view I can do this:

URL(LogIn)

But in a template file I have to do this:

URL(MyApp::Controllers::LogIn)

Is there anyway around this?

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


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  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  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  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 
>> 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).
>>
>> Anoth

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  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  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 
> 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  wrote:
&g

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  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  wrote:
>
>
> Arg, I new it would be something simple. Thanks.
>
> Dave
>
> On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnet 
> 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  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  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 whe

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  wrote:
> Arg, I new it would be something simple. Thanks.
>
> Dave
>
> On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnet  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  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  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: 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  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
Arg, I new it would be something simple. Thanks.

Dave

On Thu, Jul 8, 2010 at 10:54 PM, Philippe Monnet  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  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  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: 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  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  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  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


Re: Camping 2.1 and whywentcamping.com

2010-06-30 Thread David Susco
>From an SEO standpoint rubycamping is probably the better choice over
whywentcamping. Although changing the header to "Camping, a Ruby
Microframwork" would probably be enough anyway.

Dave

On Wed, Jun 30, 2010 at 8:57 AM, Philippe Monnet  wrote:
> Thanks Magnus! I love the idea of working on the web site for 2.1.
> I am still not crazy about the web site name though - as it is not easy for
> people to remember if they don't know the connection with _why. I personally
> would have preferred rubycamping.com or something linking Camping to Ruby
> somehow. But if everyone prefers that name I am fine with that.
>
> A couple ideas for the site:
>
> Keep the home page simple with all content fitting within 1280 x 1024
> Use a catchy design (need some help here)
> Accentuate that Camping is about Ruby (maybe also include the ruby logo
> somewhere)
> 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
> 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
>
> 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
> 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.)?
> How about a page about plugins with some brief description of their intent?
> I would love for us to include _why's cartoons in some of the sub pages ;-)
>
> Who would be interested in working together on the site?
> Could we do a couple graphic mockups of the main page? How should we
> exchange them? Via the mailing list?
> I am ready and excited to help with that. I think it would be great to
> launch the site in time for _Why Day (Aug 19th)!
>
> Philippe
>
> On 6/30/2010 5:08 AM, Magnus Holm wrote:
>
> Hey campers!
>
> I think it's about time to release Camping 2.1, which features:
>
> * Support for other template engines (Haml, ERB, etc) out of the box
> * No longer depends on ActiveRecord (this was a bug)
> * Camping.options is now a Hash where you can put all sorts of
> configuration stuff
> * Camping::Server now uses Rack::Server (got rid of some code)
> * See all changes here:
> http://github.com/camping/camping/compare/2.0...master
>
> --
>
> There's still one thing I want to improve before we release 2.1
> though, and that is the website. Currently it only redirects to the
> RDoc, but I believe we can do better.
>
> Checkout this: http://whywentcamping.judofyr.net/ (also see the GitHub
> repo for some more information:
> http://github.com/camping/whywentcamping.com)
>
> Better? Worse? You tell me :-)
>
> Have a look at the issues I'm aware of
> (http://github.com/camping/whywentcamping.com/issues) and please add
> your own too.
>
> // 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


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
Is the hoe gem installed?

Dave

On Tue, Jun 8, 2010 at 1:01 PM, Raimon Fernandez  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: 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  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
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  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: [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  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  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


restful camping with reststop

2010-03-12 Thread David Susco
Has anyone managed to get camping to work with reststop using 1.9.354?

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


sending data/overriding response headers?

2010-03-03 Thread David Susco
Hey guys,

A user would like to download a table dump as a CSV, what's the best
way to do this?

ActionController has send_data:

http://api.rubyonrails.org/classes/ActionController/Streaming.html

Is there something similar built into Camping?

If not, is there a way to override the response headers of a
controller to declare the response as something other than HTML (so
the csv isn't displayed in the browser)?

-- 
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  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  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


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


is there a way to configure line breaks in markaby output?

2009-11-02 Thread David Susco
Hi all,

Instead of having the following:

def index
  h1 'My Site'
  p 'Welcome to my site!'
end

output this:

My SiteWelcome to my site!

Is there anyway that I can configure Markaby to add line breaks
between block elements so I'd get something like this:

My Site

Welcome to my site!

Obviously it makes no difference to the browser, it would just make it
easier on me when debugging and testing.

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


Re: hi all! can't open github!!

2009-08-18 Thread David Susco
It's a link to a web comic, xkcd. It's work safe.

On Mon, Aug 17, 2009 at 9:35 PM, in-seok hwang wrote:
> What is this url(http://xkcd.com/624/)?
>
>
> 2009/8/17 Dave Everitt 
>>
>> ROFL! - DaveE
>>
>>> If they weren't then, they are now:
>>> http://xkcd.com/624/
>>
>> ___
>> 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 partials when using ERB for views

2009-06-19 Thread David Susco
This is what I came up with in the end:

module Helpers
  def method_missing symbol, *args
unless /^_/!~symbol.to_s
  partial symbol.to_s
else
  super
end
  end

  def partial p
ERB.new(File.read "./crud/views/#{p}.erb").result(binding)
  end
end

I took a look at the route maker, and rather than modify that to have
all controllers inherit a Partials module I just added the above to
the Helpers module.

Design wise it's not perfect. Partials really belong in the Views
module, but with no equivalent to the Mab object when using ERB I
couldn't figure out a way to access partials from the Views module.

Dave

On Tue, Jun 16, 2009 at 3:18 PM, David Susco wrote:
> So I like using ERB for views and have it implemented something like this:
>
> render t
>  content = ERB.new(File.read "./some_app/views/#{t}.erb").result binding
>  ERB.new(File.read "./some_app/views/layout.erb").result binding
> end
>
> So, effectively I have no Views module. However, I'd like to make use
> of some partials as well. I can make a method for every partial and
> throw it in the Helpers module but that doesn't seem like the right
> road. Does anyone have any suggestions? I tried creating a partial
> method in the main module:
>
> def partial p
>  ERB.new(File.read "./some_app/partials/#{p}.erb").result binding
> end
>
> And then tried overriding missing_method to be fancy:
>
> def missing_method symbol, args*
>  p = symbol.to_s
>  if p[0] == '_'
>    partial p
>  else
>    super
>  end
> end
>
> So I could call partials like this '_some_partial' but as the
> Controller is calling render, I would have to do this in every
> controller class I think. Does anyone have other suggestions?
>
> --
> Dave
>



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


using partials when using ERB for views

2009-06-16 Thread David Susco
So I like using ERB for views and have it implemented something like this:

render t
  content = ERB.new(File.read "./some_app/views/#{t}.erb").result binding
  ERB.new(File.read "./some_app/views/layout.erb").result binding
end

So, effectively I have no Views module. However, I'd like to make use
of some partials as well. I can make a method for every partial and
throw it in the Helpers module but that doesn't seem like the right
road. Does anyone have any suggestions? I tried creating a partial
method in the main module:

def partial p
  ERB.new(File.read "./some_app/partials/#{p}.erb").result binding
end

And then tried overriding missing_method to be fancy:

def missing_method symbol, args*
  p = symbol.to_s
  if p[0] == '_'
partial p
  else
super
  end
end

So I could call partials like this '_some_partial' but as the
Controller is calling render, I would have to do this in every
controller class I think. Does anyone have other suggestions?

-- 
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 Susco wrote:
> OK, good to know. What the latest version I can use?
>
> Dave
>
> On Wed, Jun 10, 2009 at 5:46 PM, Magnus Holm 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  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 Susco 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 Groll
>>> > 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.
>>> >>
>>

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 Holm 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  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 Susco 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 Groll
>> > 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 a

Re: Camping tutorials for education?

2009-06-10 Thread David Susco
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 Susco 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 Groll 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:
>>
>> 
>>              Options ExecCGI FollowSymLinks
>>                 AllowOverride all
>>                    Allow from all
>> 
>> 
>>    ServerName www.rackexample.com
>>    DocumentRoot /var/www/blog/public
>> 
>>
>> 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


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 Groll 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:
>
> 
>              Options ExecCGI FollowSymLinks
>                 AllowOverride all
>                    Allow from all
> 
> 
>    ServerName www.rackexample.com
>    DocumentRoot /var/www/blog/public
> 
>
> 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-09 Thread David Susco
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.

Dave

On Tue, Jun 9, 2009 at 6:35 AM, Dave Everitt wrote:
> I'm planning to use Camping to teach the basics of frameworks, and encourage
> new arrivals from web design to take up Ruby instead of (say) defaulting to
> PHP. To do this, I need a foolproof set of instructions for both the
> technicians (who have to install on all the studio machines) and the
> students.
>
> To go further, I'd like to get an opinion on the following:
>
> 1. SQLIte/ActiveRecord
> I've had some trouble getting Camping to write to an SQLite database as it
> should (post 'sqlite3 connection problem' has the details). To prepare
> instructions, I need to understand exactly why this is happening (in case it
> happens on a student's machine), so I'll persist and get it solved, somehow.
>
> 2. Obtaining the definitive current stable version
> What's the consensus on the definitive stable version? And where is it? The
> bleeding edge download from http://gems.judofyr.net/ is at 1.9.316, yet
> Picnic includes Camping 2.0 (which I thought didn't exist yet), but if I
> 'gem update' my 1.5 version, Camping remains at 1.5? I hope you can
> understand the confusion (on behalf of my future students) here.
>
> 3. Rack
> At which version (see [2]) did Camping start depending on Rack (as stated
> at: http://github.com/why/camping/tree/master)? Just out of interest, is it
> still possible to run a Camping app without it?
>
> 4. Comparing servers
> Is there any consensus on running Camping with: Apache, Mongrel, fast_cgi,
> plain old CGI, etc.? Which is the most efficient, future-proof,
> quickest/easiest to set up, and is there any information that charts the
> methods and differences? In a production environment, the URLs are obviously
> an issue here, so some mod_rewrite (or -like) examples would also be good.
>
> With all this I also want to lower the entry bar to Camping for new users by
> attempting some nice, simple documentation just to get people going, which
> is the thing I've been struggling to do myself.
>
> Dave
>
> ___
> 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: sqlite3 connection problem

2009-06-09 Thread David Susco
What version of the gem are you using? 1.2.4? I'm assuming you
compiled ruby yourself based off of its location, did you compile
sqlite as well or get it through your OS package manager? In either
case, I've found you'll need the sqlite header files for the gem to
work correctly. In your package manager they're probably called
sqlite-devel or something like that.

Dave

On Tue, Jun 9, 2009 at 8:26 AM, Eric Mill wrote:
> Are the permissions on the file set right? What happens if you try to
> access the file with rhe sqlite3 command line tool and run the query
> yourself?
>
> -- Eric
>
> On Tue, Jun 9, 2009 at 6:35 AM, Dave Everitt wrote:
>> Any feedback appreciated on the following. My most recent attempt to
>> identify the issue is a minimal Ruby/SQLite/ActiveRecord script, Pastied
>> here: http://pastie.textmate.org/492514 which brings up the following when
>> run from the command line (an empty database file already exists):
>>
>> $ ./simple_db.rbx
>> [SNIP]/active_record/connection_adapters/sqlite3_adapter.rb:29:in
>> `table_structure': Could not find table 'users'
>> (ActiveRecord::StatementInvalid)
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/object/misc.rb:39:in
>> `returning'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in
>> `table_structure'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite_adapter.rb:213:in
>> `columns'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:1276:in
>> `columns'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:3008:in
>> `attributes_from_column_definition_without_lock'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/locking/optimistic.rb:66:in
>> `attributes_from_column_definition'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:2435:in
>> `initialize'
>>        from ./simple_db.rbx:10:in `new'
>>        from ./simple_db.rbx:10
>>
>> The adapted blog example code I want to run for my students as an example is
>> Pastied at: http://pastie.org/492517 so I'd appreciate the identification of
>> any glaring errors (currently Camping 1.5 under plain CGI):
>>
>> The errors in the server log read:
>> [SNIP]/activerecord-2.3.2/lib/active_record/connection_adapters/abstract_adapter.rb:212:in
>> `log': SQLite3::SQLException: unable to open database file: CREATE TABLE
>> "blogtiny_schema_infos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
>> "version" float)  (ActiveRecord::StatementInvalid)
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite_adapter.rb:157:in
>> `execute'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite_adapter.rb:402:in
>> `catch_schema_changes'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite_adapter.rb:157:in
>> `execute'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in
>> `create_table'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:352:in
>> `send'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:352:in
>> `method_missing'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:328:in
>> `say_with_time'
>>        from /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:328:in
>> `say_with_time'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:348:in
>> `method_missing'
>>        from (eval):71:in `create_schema'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/schema.rb:43:in
>> `instance_eval'
>>        from
>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/schema.rb:43:in
>> `define'
>>        from (eval):70:in `create_schema'
>>        from /Users/deveritt/Sites/cgi-bin/camping/blogtiny.rbx:71:in
>> `create'
>>        from /Users/deveritt/Sites/cgi-bin/camping/blogtiny.rbx:77
>> [Thu May 28 12:18:13 2009] [error] [client 127.0.0.1] malformed header from
>> script. Bad header=-- create_table("blogtiny_sche:
>> /Users/deveritt/Sites/cgi-bin/camping/blogtiny.rbx
>>
>> Note the odd truncation of 'blogtiny_sche' in the final line.
>>
>> And one dumb question:
>> I don't have to 'require sqlite3-ruby', right?
>>
>> Dave
>>
>> ___
>> Camping-list mailing list
>> Camping-li

Re: deployment

2009-06-05 Thread David Susco
I haven't looked into Rack in depth, is there a camping/rack/mongrel
tutorial out there?

Dave

On Fri, Jun 5, 2009 at 1:54 AM, Jonathan Groll wrote:
> Hi David,
>
> On Wed, Jun 03, 2009 at 10:24:01AM -0400, David Susco wrote:
>>
>> I have a few camping apps I'd like to start automatically if my server
>> ever restarts. There's an init.d file that comes with mongrel_cluster
>> that you can use for rails apps, is there anything out there for
>> camping apps though?
>>
>> With the postamble containing all the configuration for the app, it
>> seems that all the init.d file would have to do is execute the camping
>> file. Has anyone done this/have any pointers?
>
> I know this is not exactly what you're asking since your question was
> mongrel based, but if you were to look at running camping 2.0 with
> passenger/rack you would get automatic restarts as well as working
> redirects. Plus you'd be able to also easily deploy rails apps (and
> even some python apps) with the same setup.
> Cheers,
> 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


deployment

2009-06-03 Thread David Susco
I have a few camping apps I'd like to start automatically if my server
ever restarts. There's an init.d file that comes with mongrel_cluster
that you can use for rails apps, is there anything out there for
camping apps though?

With the postamble containing all the configuration for the app, it
seems that all the init.d file would have to do is execute the camping
file. Has anyone done this/have any pointers?

-- 
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  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  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  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  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 
>> >> 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 
>> >>> 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  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  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  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  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  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  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 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  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  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  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-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  wrote:
> Within an apache vhost I'm rewriting like this:
>
>    
>      RewriteEngine On
>      RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
>      RewriteRule ^/(.*)$ http://127.0.0.1:5000/$1 [P,QSA,L]
>    
>
> 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  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  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


using ActiveRecord::Validations::ClassMethods

2009-05-20 Thread David Susco
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


Re: using redirect with a mongrel server behind apache

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


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


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  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  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


using redirect with a mongrel server behind apache

2009-05-19 Thread David Susco
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