src

2016-05-27 Thread GM Rubinstein
original src 2016

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


camping.rb -- so you know what gmane.comp.lang.ruby.camping.general is all about.

2016-05-27 Thread GM Rubinstein
# == About camping.rb
#
# Camping comes with two versions of its source code.  The code contained in
# lib/camping.rb is compressed, stripped of whitespace, using compact
algorithms
# to keep it tight.  The unspoken rule is that camping.rb should be
flowed with
# no more than 80 characters per line and must not exceed four kilobytes.
#
# On the other hand, lib/camping-unabridged.rb contains the same code,
laid out
# nicely with piles of documentation everywhere. This documentation is
entirely
# generated from lib/camping-unabridged.rb using RDoc and our "flipbook"
template
# found in the extras directory of any camping distribution.
require "uri"
require "rack"

$LOADED_FEATURES << "camping.rb"

class Object #:nodoc:
  def meta_def(m,) #:nodoc:
(class< 0
  #   page -= 1
  # end
  # @posts = Post.all, :offset => page * 20, :limit => 20
  # render :index
  #   end
  # end
  #   end
  #
  # In the above example if you visit /?page=2, you'll get the
second
  # page of twenty posts.  You can also use @input['page'] to
get the
  # value for the page query variable.
  class H < Hash
# Gets or sets keys in the hash.
#
#   @cookies.my_favorite = :macadamian
#   @cookies.my_favorite
#   => :macadamian
#
def method_missing(m,*a)
m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m.to_s]:super
end
undef id, type if ?? == 63
  end

  class Cookies < H
attr_accessor :_p
#
# Cookies that are set at this response
def _n; @n ||= {} end

alias _s []=

def set(k, v, o = {})
  _s(j=k.to_s, v)
  _n[j] = {:value => v, :path => _p}.update(o)
end

def []=(k, v)
  set k, v, v.is_a?(Hash) ? v : {}
end
  end

  # Helpers contains methods available in your controllers and views.
You may
  # add methods of your own to this module, including many helper
methods from
  # Rails. This is analogous to Rails' ApplicationHelper module.
  #
  # == Using ActionPack Helpers
  #
  # If you'd like to include helpers from Rails' modules, you'll need to
look
  # up the helper module in the Rails documentation at
http://api.rubyonrails.org/.
  #
  # For example, if you look up the
ActionView::Helpers::FormTagHelper
  # class, you'll find that it's loaded from the
action_view/helpers/form_tag_helper.rb
  # file. You'll need to have the ActionPack gem installed for this to work.
  #
  # A helper often depends on other helpers, so you would have to look up
  # the dependencies too. FormTagHelper for instance required the
  # content_tag provided by TagHelper.
  #
  #   require 'action_view/helpers/form_tag_helper'
  #
  #   module Nuts::Helpers
  # include ActionView::Helpers::TagHelper
  # include ActionView::Helpers::FormTagHelper
  #   end
  #
  # == Return a response immediately
  # If you need to return a response inside a helper, you can use
throw :halt.
  #
  #   module Nuts::Helpers
  # def requires_login!
  #   unless @state.user_id
  # redirect Login
  # throw :halt
  #   end
  # end
  #   end
  #
  #   module Nuts::Controllers
  # class Admin
  #   def get
  # requires_login!
  # "Never gets here unless you're logged in"
  #   end
  # end
  #   end
  module Helpers
# From inside your controllers and views, you will often need to
figure out
# the route used 

Re: serving static files

2015-03-27 Thread Sebastjan Hribar
Hi Ben,

I apologize for the late reply. For some reason your reply went to the spam
folder.

Anyway, your solution works perfectly:)

Thank you!
regards,
Seba

2015-03-23 20:15 GMT+01:00 Ben Schumacher m...@benschumacher.com:

  Sebastian-

 It's hard to guess what the issue with Camping is without a little more
 detail.

 You could achieve the same result by having Rack serve the static files,
 and skip Camping altogether. Something like this in your config.ru:

 require 'app'
 use Rack::Static, :urls = ['/static', ], :root = 'parent-of-static'
 run Rack::Adapter::Camping.new(app)


 Hope this helps,
 BEn


 On 3/23/15 6:40 AM, Sebastjan Hribar wrote:

 Hi,

  I have a problem with serving static files in my app.
 I use the code as shown here (
 https://github.com/judofyr/camping/wiki/Serving-Static-Files).
 I had to remove the @ sign for FILE to make it work.

  For now I'm only serving one background image:
 --
  #index_main {
   background-size: cover;
   background-image: url(static/slika2.jpg)
 }
  --

  When I do this in my windows running from command line the image is
 served.

  When I do this in windows server 2008 running as a service, the image is
 not shown and if I try accessing it like address:3301/static/slika2.jpg
 I get this error:

  Camping Problem!
 /static/slika2.jpg not found

  I'm using config.ru like so:

   $LOAD_PATH  File.expand_path('..')  require './app_name'  
 app_name.create  run app_name

  Should I add anything for the static files in config.ru as well?

  I use thin as the server.

  thank you!
 regards,
 seba


 ___
 Camping-list mailing 
 listCamping-list@rubyforge.orghttp://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

serving static files

2015-03-23 Thread Sebastjan Hribar
Hi,

I have a problem with serving static files in my app.
I use the code as shown here (
https://github.com/judofyr/camping/wiki/Serving-Static-Files).
I had to remove the @ sign for FILE to make it work.

For now I'm only serving one background image:
--
#index_main {
  background-size: cover;
  background-image: url(static/slika2.jpg)
}
--

When I do this in my windows running from command line the image is served.

When I do this in windows server 2008 running as a service, the image is
not shown and if I try accessing it like address:3301/static/slika2.jpg
I get this error:

Camping Problem!
/static/slika2.jpg not found

I'm using config.ru like so:

  $LOAD_PATH  File.expand_path('..')  require './app_name'
app_name.create  run app_name

Should I add anything for the static files in config.ru as well?

I use thin as the server.

thank you!
regards,
seba
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

authentication system in camping error

2015-03-14 Thread Sebastjan Hribar

Hi guys,

I've just posted a question on SO regarding the authentication system 
I've setup in my camping app and I can't resolve the error by myself. I 
don't think it's related to camping itself, but maybe to AR or something 
else.


If anyone wants to have a look, here's the link: 
http://stackoverflow.com/questions/29054151/authentication-fails-in-camping-web-app-after-attribute-update.


Direct link to my gist is here: 
https://gist.github.com/sebastjan-hribar/38b5b640ffd29d96cc70.


The problem is that user authentication fails after user attribute has 
been updated in the database. Prior to that, everything works fine.


thank you for your help,
regards
seba
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: problems with console - uninitialized constant

2015-03-09 Thread Sebastjan Hribar

Hi Paul,

you're right. I've mixed the two:(
It works now.

regards
Seba

Dne 09. 03. 2015 ob 21:29 je Paul van Tilburg zapisal(a):

On Mon, Mar 09, 2015 at 07:24:38PM +0100, Sebastjan Hribar wrote:

I'm having problems with the console. When I try to create a new user, I get
this error:

2.1.5 :001  user = User.new(username: hribar, email: s...@test.com,
password: qwert, password_confirmation: qwert)
NameError: uninitialized constant User

Yes, this is normal.  Unlike the Rails console, the Camping console does not
include the model module.  So, you probably need to do:


include MyApp::Models

Object

first.

Paul



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


problems with console - uninitialized constant

2015-03-09 Thread Sebastjan Hribar

Hi,

I'm having problems with the console. When I try to create a new user, I 
get this error:


2.1.5 :001  user = User.new(username: hribar, email: s...@test.com, 
password: qwert, password_confirmation: qwert)

NameError: uninitialized constant User
from (irb):1
from 
/home/sebastjan/.rvm/gems/ruby-2.1.5/gems/camping-2.1.532/lib/camping/server.rb:138:in 
`start'
from 
/home/sebastjan/.rvm/gems/ruby-2.1.5/gems/rack-1.6.0/lib/rack/server.rb:147:in 
`start'
from 
/home/sebastjan/.rvm/gems/ruby-2.1.5/gems/camping-2.1.532/bin/camping:9:in 
`top (required)'

from /home/sebastjan/.rvm/gems/ruby-2.1.5/bin/camping:23:in `load'
from /home/sebastjan/.rvm/gems/ruby-2.1.5/bin/camping:23:in `main'
from 
/home/sebastjan/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
from 
/home/sebastjan/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in 
`main'



Why is the reported User uninitialized?

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


migrations issues

2015-01-02 Thread Sebastjan Hribar

Hi,

I'm still having problem with running migrations. I've tried the code below:


class FormStatusField  V 1.1

def self.up

add_column(Reviewform.table_name, :status, :string)

Reviewform.reset_column_information

end

def self.down

remove_column(Reviewform.table_name, :status)

end

end


And with ActiveRecord 4.0.4 this gives me the error below:


 NoMethodError at /form/new


   undefined method `status' for
   #Review::Models::Reviewform:0x0002ca27c0

Ruby



|/home/sebastjan/.rvm/gems/ruby-2.1.5/gems/activemodel-4.0.4/lib/active_model/attribute_methods.rb|: 
in|method_missing|, line 439


Web



|GET localhost/form/new|


The column is not added which I confirm by browsing the sql table.


I've tried the later AR version, namely 4.2.0 and I can't even run the 
initial migration. I guess this is related to this issue 
https://github.com/camping/camping/issues/77.


As this problem in general is probably related to AR, can someone 
confirm for which AR version migrations run fine.


This is crucial to my app as I need to deploy it productively this month 
and currently I can bypass this issue only by switching databases and 
refactor the initial migration.



Additional note: this code from the book also didn't work

|  ||class
AddTagColumn  V 1.1|

|
   ||def
self.change|

|
||add_column
Page.table_name, :tag, :string|

|
||Page.reset_column_information|

|
   ||end|

|
 ||end|

regards,

seba

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

Re: camping with prawn

2014-12-01 Thread Sebastjan Hribar
I was confused with two options: generating a PDF view template and 
saving to PDF. I've successfully implemented the latter with the below 
changes to my view:


  def showpdf
if File.exist?(#{@reviewform.title}.pdf)
  h4 PDF-document already exists.
else
  pdf = Prawn::Document.new
  pdf.text #{@reviewform.title}
  pdf.render_file #{@reviewform.title}.pdf
  h4 PDF-document was successfully saved.
end
  end

This is just basic stuff to test it.

Can someone still confirm this is the right way, and how would I go 
about the view template method so when the user visits this view, the 
pdf format would be rendered and then they could save that?


regards,
seba


Dne 01. 12. 2014 ob 20:20 je Sebastjan Hribar zapisal(a):

Hi guys,

can someone help me with this challenge. I'd like to be able to save 
reviewforms from my app to PDF files. I'm struggling because there is 
no explicit examples, but I try to derive the correct way from rails 
examples.


So, I've made this:

I've created a separate controller for showing a reviewform in a PDF 
format:


  class ShowPdfN
def get(form_id)
  if @state.username
@reviewform = Reviewform.find(form_id)
render :showpdf
  else
redirect Login
  end
end
  end

And the view with basic stuff:

  def showpdf
pdf = Prawn::Document.new
pdf.text #{@reviewform.title}
  end

When I wisit http://localhost:3301/show/pdf/1 there is nothing to 
display.


Any ideas?

regards,
seba


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


small custom erp - can I do it in camping

2014-10-25 Thread Sebastjan Hribar

Hi,

I need advice before I decide to start my next project.
Since camping is intended for smaller apps I'm not sure whether I should 
try to use it for my small custom erp app.


_Here's what I had in mind:_ create several apps for separate erp 
modules or submodules even and have them use the same database.


Since I'm very pleased with my first camping app for quality assurance 
which we use productively I'd like to just add all modules.


_Size:_
- 4 additional main modules with (currently) 22 models


Could I pull this off in camping or must I consider rails?

regards,
seba

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

Re: The 2.2 release

2014-10-08 Thread Paul van Tilburg
On Sat, Sep 06, 2014 at 11:08:04PM +0200, Paul van Tilburg wrote:
 I'd be happy with a 2.1.x release though!

So, what is this numbering after 2.1 about actually?  What is the
system?

What are your experiences with AR4 and Camping?
I've made some adjustments (mainly to most queries) in my application
but it seems to run fine now.  What about you guys?

Cheers,

Paul

-- 
Web: http://paul.luon.net/home/  | E-mail: 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


ActiveRecord - issues with schema

2014-10-02 Thread Sebastjan Hribar

Hi,

My apps recently stopped working. Right after I launch the server I get 
(errors from sample app)


ActiveRecord::RecordNotFound at /
Couldn't find Test::Models::SchemaInfo with 'id'=firstRuby 
/home/sebastjan/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.5/lib/active_record/relation/finder_methods.rb: 
in raise_record_not_found_exception!, line 320



and upon refresh

TypeError at /
superclass mismatch for class BasicFieldsRubytest.rb: in 
module:Models, line 10



I've noticed this recently when I started deploying with phusion 
passenger and I thought the issue was related to passenger (admittedly, 
one of the issues was:)


Then, the only thing I could come up with that could be the cause is the 
AR as I've updated it because I've started learning rails.


gem list shows:

...
activemodel (4.1.5, 4.0.4)
activerecord (4.1.5, 4.0.4)
activerecord-deprecated_finders (1.0.3)
activesupport (4.1.5, 4.0.4, 2.3.18)
...

Are my assumptions about AR correct? Because I haven't made any changes 
to the code itself.


Also, .camping.db contains schemas for separate apps, however each table 
only has the id and version fields. It seems migrations are not running 
at all?


If the problem is in AR, how can I use older version for camping and 
newer for rails?


Thank you for your help.
regards
seba
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


The 2.2 release

2014-09-06 Thread Paul van Tilburg
Hi,

While I am quite aware that development has pretty much stalled, I
wondered if it would still be possible to have some kind of 2.2 release
out[1]?  For me, Camping still works just great with my applications and
also with AR4, so I am still quite happy with it. 

I am currently working on the Debian packaging again, since a freeze for the
upcoming release is nigh.  At the moment Debian ships version 2.1.532,
but it doesn't work with AR4.  I've noticed that HEAD _does_ work for me,
but I'd prefer not to ship 2.1.532+gitsome snapshot unless necessary.

So I was wondering: is it release ready (see also [1]) and what are
the experiences of you guys with the current state of Camping?

Cheers,

Paul


1: https://github.com/camping/camping/milestones/Camping%202.2

-- 
Web: http://paul.luon.net/home/  | E-mail: 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


Re: The 2.2 release

2014-09-06 Thread Magnus Holm
I can easily release a new 2.1.x. Not sure if we need a 2.2 yet?

On Saturday, September 6, 2014, Paul van Tilburg p...@luon.net wrote:

 Hi,

 While I am quite aware that development has pretty much stalled, I
 wondered if it would still be possible to have some kind of 2.2 release
 out[1]?  For me, Camping still works just great with my applications and
 also with AR4, so I am still quite happy with it.

 I am currently working on the Debian packaging again, since a freeze for
 the
 upcoming release is nigh.  At the moment Debian ships version 2.1.532,
 but it doesn't work with AR4.  I've noticed that HEAD _does_ work for me,
 but I'd prefer not to ship 2.1.532+gitsome snapshot unless necessary.

 So I was wondering: is it release ready (see also [1]) and what are
 the experiences of you guys with the current state of Camping?

 Cheers,

 Paul


 1: https://github.com/camping/camping/milestones/Camping%202.2

 --
 Web: http://paul.luon.net/home/  | E-mail: p...@luon.net
 javascript:;
 Jabber/GTalk: p...@luon.net javascript:;  | GnuPG key ID:
 0x50064181
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org javascript:;
 http://rubyforge.org/mailman/listinfo/camping-list



-- 

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

Re: The 2.2 release

2014-09-06 Thread Paul van Tilburg
On Sat, Sep 06, 2014 at 09:41:00PM +0200, Magnus Holm wrote:
 I can easily release a new 2.1.x. Not sure if we need a 2.2 yet?

I am not sure either, especially since the milestone has open issues
but I wonder if they still should all be open.
Are there other 2.2 goals?

I'd be happy with a 2.1.x release though!

Cheers,

Paul

-- 
Web: http://paul.luon.net/home/  | E-mail: 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


Re: Is there a way to remove mab and ar from camping?

2014-06-25 Thread Lázaro Armando
A far as I know, Model is an empty module until something from base is  
called. Then you shall rewrite The migration schema in models. Leave  
it to the orm from outside would be against the camping's philosofy  
(all in one file)



Sent from my iPhone

On jun 24, 2014, at 6:48 a.m., Tim Uckun timuc...@gmail.com wrote:

 If I want to use other things can they be removed without hacking  
 the code? If I do fork it and remove them will the rest of the stuff  
 work?
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: app doesn't run on windows

2014-06-09 Thread Sebastjan Hribar
Hi,

unfortunatelly I had to postpone deployment on Windows, but I also had no
luck yet with sqlite on windows either.
When I continue I think we'll go with the linux server to deploy the app.

I'll post if we do it in windows environtment.

regards
seba


2014-06-07 18:31 GMT+02:00 Magnus Holm judo...@gmail.com:

 Did you find a solution?

 It's been a while since I've been testing Camping on Windows, so I'm not
 quite sure how to set up SQLite properly.

 // Magnus


 On Friday, May 16, 2014, Sebastjan Hribar sebastjan.hri...@gmail.com
 wrote:

 Note: the error is caused by not having sqlite setup properly in windows
 and I'm still struggeling:(

 The app itself is fine.

 regards
 seba


 2014-05-15 10:37 GMT+02:00 Sebastjan Hribar sebastjan.hri...@gmail.com:

 Hi,

 I have problem running the app in windows. This is the app I've asked
 question about recently (the review app).

 It runs ok in my linux mint debian edition, but on windows it doesn't.
 First issue was with encoding. Even if I've set the meta charset it
 didn't work. Now I've also set the enocoding to the utf-8 in the .rb file
 itself and I don't get any more errors.

 But I do get this error:
  Camping Problem! / not found

 And that's it. No other info. The app is exactly the same as the one
 running in LMDE.

 Could this issue be related to the campging.db? I can't find it on
 windows. Is it possible tha camping is denied the access to the folder
 where it should be created?


 regards,

 seba




 --

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

Re: first app - some questions

2014-06-09 Thread Sebastjan Hribar
Thank you for the detailed description!

I have one question about the @state. Where does the method user_id come
from? I've been going through the unabridged source and Camping::Session
reference, but I guess I'm not proficient enough:)

And what else can be also saved in the @state?

regards
seba


2014-06-07 18:42 GMT+02:00 Magnus Holm judo...@gmail.com:

 On Saturday, May 3, 2014, Sebastjan Hribar sebastjan.hri...@gmail.com
 wrote:

  Hi guys,

 just a little feedback from a beginner. I've finished my first camping
 app. Thank you for your help and guidance.

 The finished app is about quality management and enables users to fill
 out forms. Based on those forms different quality parameters are recorded
 per user and per project. These can be called up in summary reports for
 desired time frame and user. Along with all the forms for a period the
 average quality evaluation is also displayed. Reports can only be generated
 by quality managers.

 I've managed to reuse only one html form for creating, viewing and
 editing. In addition, I've setup the form in such a way, that submitting is
 possible only when the form was called via »new« or »edit« route and the
 user has appropriate authorizations.

 I have one question regarding the session. I don't actually know how to
 leverage or use it. According to the reference the session adds states to
 the app. Can someone explain a bit more?


 Sorry for the late reply.

 Here's an example of state:

   module App::Controllers
 class Index
   def get
 if @state.user_id
   Welcome user number #{@state.user_id}
 else
   render :login
 end
   end

   class Login
 def post
   # Just log everyone in. No passwords here!
   @state.user_id = @input.user_id
   redirect Index
 end
  end
end

   module App::Views
 def login
   form action: R(Login), method: :post do
 label do
   p User ID:
   input name: :user_id
 end
 button Log in
end
  end
   end

 Here's an example of the flow when the user visits the site:

 1. User visits GET /. Index#get is called.
 2. The state is empty, so the #login view is rendered
 3. The user enters his user ID (let's say 5).
 4. When the user presses Log in, the browser will do a POST /login with
 user_id=5 as parameters
 5. Login#post is invoked. This sets the state variable and then redirects
 to /.
 6. The user's browser then shows GET /. Now he gets a welcome message, not
 the login form.

 Notice how the same request is done in both step 1 and 6 (GET /), but the
 second time the user gets a completely different page. That's because the
 state is different.

 You might know about cookies: sessions are like cookies that only the
 server know how to set. It's impossible for the client to set its own
 session; every session has to be set through the @state-variable in an
 action.

 I hope this clarifies state/sessions a bit. Don't hesitate to ask more if
 you're confused.

 // Magnus


 --

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

Re: first app - some questions

2014-06-09 Thread Magnus Holm
On Monday, June 9, 2014, Sebastjan Hribar sebastjan.hri...@gmail.com
wrote:

 Thank you for the detailed description!

 I have one question about the @state. Where does the method user_id come
 from? I've been going through the unabridged source and Camping::Session
 reference, but I guess I'm not proficient enough:)

 And what else can be also saved in the @state?

 regards
 seba


@state (and @input) is an instance of Camping::H. Camping::H is a Hash with
some sugar. You can use it like a regular Hash (it's actually a subclass of
Hash):

  @state[user_id] = 1
  @state[user_id] # = 1

But it also supports method-like access:

  @state.user_id = 1
  @state.user_id # = 1

As long as it's not a method on Hash, you can use it as a getter/setter.

You can save anything that can be serialized using Marshal:

  Marshal.dump(123) # = \x04\bi\x01{
  Marshal.load(\x04\bi\x01{) # = 123


-- 

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

Re: app doesn't run on windows

2014-06-07 Thread Magnus Holm
Did you find a solution?

It's been a while since I've been testing Camping on Windows, so I'm not
quite sure how to set up SQLite properly.

// Magnus

On Friday, May 16, 2014, Sebastjan Hribar sebastjan.hri...@gmail.com
wrote:

 Note: the error is caused by not having sqlite setup properly in windows
 and I'm still struggeling:(

 The app itself is fine.

 regards
 seba


 2014-05-15 10:37 GMT+02:00 Sebastjan Hribar sebastjan.hri...@gmail.com
 javascript:_e(%7B%7D,'cvml','sebastjan.hri...@gmail.com');:

 Hi,

 I have problem running the app in windows. This is the app I've asked
 question about recently (the review app).

 It runs ok in my linux mint debian edition, but on windows it doesn't.
 First issue was with encoding. Even if I've set the meta charset it
 didn't work. Now I've also set the enocoding to the utf-8 in the .rb file
 itself and I don't get any more errors.

 But I do get this error:
  Camping Problem! / not found

 And that's it. No other info. The app is exactly the same as the one
 running in LMDE.

 Could this issue be related to the campging.db? I can't find it on
 windows. Is it possible tha camping is denied the access to the folder
 where it should be created?


 regards,

 seba




-- 

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

Re: first app - some questions

2014-06-07 Thread Magnus Holm
On Saturday, May 3, 2014, Sebastjan Hribar sebastjan.hri...@gmail.com
wrote:

  Hi guys,

 just a little feedback from a beginner. I've finished my first camping
 app. Thank you for your help and guidance.

 The finished app is about quality management and enables users to fill out
 forms. Based on those forms different quality parameters are recorded per
 user and per project. These can be called up in summary reports for desired
 time frame and user. Along with all the forms for a period the average
 quality evaluation is also displayed. Reports can only be generated by
 quality managers.

 I've managed to reuse only one html form for creating, viewing and
 editing. In addition, I've setup the form in such a way, that submitting is
 possible only when the form was called via »new« or »edit« route and the
 user has appropriate authorizations.

 I have one question regarding the session. I don't actually know how to
 leverage or use it. According to the reference the session adds states to
 the app. Can someone explain a bit more?


Sorry for the late reply.

Here's an example of state:

  module App::Controllers
class Index
  def get
if @state.user_id
  Welcome user number #{@state.user_id}
else
  render :login
end
  end

  class Login
def post
  # Just log everyone in. No passwords here!
  @state.user_id = @input.user_id
  redirect Index
end
 end
   end

  module App::Views
def login
  form action: R(Login), method: :post do
label do
  p User ID:
  input name: :user_id
end
button Log in
   end
 end
  end

Here's an example of the flow when the user visits the site:

1. User visits GET /. Index#get is called.
2. The state is empty, so the #login view is rendered
3. The user enters his user ID (let's say 5).
4. When the user presses Log in, the browser will do a POST /login with
user_id=5 as parameters
5. Login#post is invoked. This sets the state variable and then redirects
to /.
6. The user's browser then shows GET /. Now he gets a welcome message, not
the login form.

Notice how the same request is done in both step 1 and 6 (GET /), but the
second time the user gets a completely different page. That's because the
state is different.

You might know about cookies: sessions are like cookies that only the
server know how to set. It's impossible for the client to set its own
session; every session has to be set through the @state-variable in an
action.

I hope this clarifies state/sessions a bit. Don't hesitate to ask more if
you're confused.

// Magnus


-- 

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

app doesn't run on windows

2014-05-15 Thread Sebastjan Hribar
Hi,

I have problem running the app in windows. This is the app I've asked
question about recently (the review app).

It runs ok in my linux mint debian edition, but on windows it doesn't.
First issue was with encoding. Even if I've set the meta charset it didn't
work. Now I've also set the enocoding to the utf-8 in the .rb file itself
and I don't get any more errors.

But I do get this error:
Camping Problem!/ not found

And that's it. No other info. The app is exactly the same as the one
running in LMDE.

Could this issue be related to the campging.db? I can't find it on windows.
Is it possible tha camping is denied the access to the folder where it
should be created?


regards,

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

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: multi-line input field

2014-05-12 Thread Sebastjan Hribar
Hi,

I can only use textarea rows:'5' @testform.testing

for displaying pruposes. As soon as I use tag input which I need for saving
the data to the database table, multiline is impossible.

regards,
seba




2014-05-12 13:39 GMT+02:00 David Susco dsu...@gmail.com:

 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

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

Re: multi-line input field

2014-05-12 Thread Magnus Holm
textareas are also submitted together with the form, you just need to set a
name:

  textarea @testform.testing, rows:5, name:'testing'

On Monday, May 12, 2014, Sebastjan Hribar sebastjan.hri...@gmail.com
wrote:

 Hi,

 I can only use textarea rows:'5' @testform.testing

 for displaying pruposes. As soon as I use tag input which I need for
 saving the data to the database table, multiline is impossible.

 regards,
 seba




 2014-05-12 13:39 GMT+02:00 David Susco 
 dsu...@gmail.comjavascript:_e(%7B%7D,'cvml','dsu...@gmail.com');
 :

 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.comjavascript:_e(%7B%7D,'cvml','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.orgjavascript:_e(%7B%7D,'cvml','Camping-list@rubyforge.org');
 http://rubyforge.org/mailman/listinfo/camping-list




 --
 Dave

 ___
 Camping-list mailing list
 Camping-list@rubyforge.orgjavascript:_e(%7B%7D,'cvml','Camping-list@rubyforge.org');
 http://rubyforge.org/mailman/listinfo/camping-list




-- 

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

Re: multi-line input field

2014-05-12 Thread Bartosz Dziewoński

On Mon, 12 May 2014 14:49:33 +0200, Sebastjan Hribar 
sebastjan.hri...@gmail.com wrote:


I can only use textarea rows:'5' @testform.testing

for displaying pruposes.


Why? textarea is the way to do multiline text inputs in HTML.

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


Re: multi-line input field

2014-05-12 Thread Sebastjan Hribar

Here was my mistake:

I thought that in order for setting the model attribute data like so:

common_attributes = {title: input.title, ..., general_remark: 
input.general_remark}


I have to explicitly state the input tag in the form like so:

input textarea @reviewform.general_remark, rows: 5, name: 'general_remark'

and this produced the error about tag not allowing the content.

3. Otherwise, I used it like so:

input type: 'textarea', name: 'suggestions_reviewer_comments', value: 
@reviewform.suggestions_reviewer_comments


And this didn't produce any errors, but on the other hand the field in 
the form had the same appearance as the 'text' field.



Thank you again.
regards,
seba

On 12. 05. 2014 15:45, Sebastjan Hribar wrote:
My assumption was based on the behavior of my form in my app. I'll 
test the way magnus wrote it and I'll post back here later today so I 
won't make any false statements.
In order to capture the data I always used the input tag and that 
didn't allow for multiple line textarea.


regards,
seba


2014-05-12 15:08 GMT+02:00 Bartosz Dziewoński matma@gmail.com 
mailto:matma@gmail.com:


On Mon, 12 May 2014 14:49:33 +0200, Sebastjan Hribar
sebastjan.hri...@gmail.com mailto:sebastjan.hri...@gmail.com
wrote:

I can only use textarea rows:'5' @testform.testing

for displaying pruposes.


Why? textarea is the way to do multiline text inputs in HTML.

-- 
Matma Rex


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




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

Re: multi-line input field

2014-05-12 Thread Sebastjan Hribar

But textarea isn't unknown or unspecified type, right?

On 12. 05. 2014 18:19, Bluebie wrote:
All web browsers will treat any unknown or unspecified type of 
input as being a text input. This is why we can have things like 
input type=email and it doesn't destroy everything :)


---
Bluebie

On Tuesday, 13 May 2014 at 1:57 am, Sebastjan Hribar wrote:


Here was my mistake:

I thought that in order for setting the model attribute data like so:

common_attributes = {title: input.title, ..., general_remark: 
input.general_remark}


I have to explicitly state the input tag in the form like so:

input textarea @reviewform.general_remark, rows: 5, name: 
'general_remark'


and this produced the error about tag not allowing the content.

3. Otherwise, I used it like so:

input type: 'textarea', name: 'suggestions_reviewer_comments', value: 
@reviewform.suggestions_reviewer_comments


And this didn't produce any errors, but on the other hand the field 
in the form had the same appearance as the 'text' field.



Thank you again.
regards,
seba

On 12. 05. 2014 15:45, Sebastjan Hribar wrote:
My assumption was based on the behavior of my form in my app. I'll 
test the way magnus wrote it and I'll post back here later today so 
I won't make any false statements.
In order to capture the data I always used the input tag and that 
didn't allow for multiple line textarea.


regards,
seba


2014-05-12 15:08 GMT+02:00 Bartosz Dziewon'ski matma@gmail.com 
mailto:matma@gmail.com:
On Mon, 12 May 2014 14:49:33 +0200, Sebastjan Hribar 
sebastjan.hri...@gmail.com mailto:sebastjan.hri...@gmail.com wrote:



I can only use textarea rows:'5' @testform.testing

for displaying pruposes.


Why? textarea is the way to do multiline text inputs in HTML.

--
Matma Rex

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




___
Camping-list mailing list
Camping-list@rubyforge.org mailto: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

Re: multi-line input field

2014-05-12 Thread Bluebie
textarea’s are made using the textarea tag. There is no such thing as input 
type=“textarea”. Maybe this comes from rails or something? In markaby unless 
you’ve created some helpers to do otherwise, it outputs whatever you write in 
your code - a call to input() wont be transformed in to a textarea or a 
button or any other kind of form element. Markaby really is just a way of 
writing html, using ruby syntax instead of xml/sgml, and not much more.  

—
Bluebie


On Tuesday, 13 May 2014 at 3:34 am, Sebastjan Hribar wrote:

 But textarea isn't unknown or unspecified type, right?
  
 On 12. 05. 2014 18:19, Bluebie wrote:
  All web browsers will treat any unknown or unspecified “type” of input as 
  being a text input. This is why we can have things like input 
  type=“email” and it doesn’t destroy everything :)  
   
  —  
  Bluebie
   
   
  On Tuesday, 13 May 2014 at 1:57 am, Sebastjan Hribar wrote:
   
   Here was my mistake:

   I thought that in order for setting the model attribute data like so:

   common_attributes = {title: input.title, ..., general_remark: 
   input.general_remark}

   I have to explicitly state the input tag in the form like so:

   input textarea @reviewform.general_remark, rows: 5, name: 'general_remark'

   and this produced the error about tag not allowing the content.

   3. Otherwise, I used it like so:

   input type: 'textarea', name: 'suggestions_reviewer_comments', value: 
   @reviewform.suggestions_reviewer_comments

   And this didn't produce any errors, but on the other hand the field in 
   the form had the same appearance as the 'text' field.


   Thank you again.
   regards,
   seba  

   On 12. 05. 2014 15:45, Sebastjan Hribar wrote:
My assumption was based on the behavior of my form in my app. I'll test 
the way magnus wrote it and I'll post back here later today so I won't 
make any false statements.
In order to capture the data I always used the input tag and that 
didn't allow for multiple line textarea.
 
regards,
seba  
 
 
2014-05-12 15:08 GMT+02:00 Bartosz Dziewoński matma@gmail.com 
(mailto:matma@gmail.com):
 On Mon, 12 May 2014 14:49:33 +0200, Sebastjan Hribar 
 sebastjan.hri...@gmail.com (mailto:sebastjan.hri...@gmail.com) 
 wrote:
  
  I can only use textarea rows:'5' @testform.testing
   
  for displaying pruposes.
  
 Why? textarea is the way to do multiline text inputs in HTML.
  
 --  
 Matma Rex  
  
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org (mailto:Camping-list@rubyforge.org)
 http://rubyforge.org/mailman/listinfo/camping-list
 

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



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


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

Re: multi-line input field

2014-05-12 Thread Sebastjan Hribar
Thank you very much for the explanation. I was puzzled  why let's say 
input tag number requires this syntax: input type = 'number' and it 
breaks when written number @@reviewform.number, name: 'number.


And the opposite is true for textarea.

regards,
seba




On 12. 05. 2014 19:44, Bluebie wrote:
textarea's are made using the textarea tag. There is no such thing 
as input type=textarea. Maybe this comes from rails or something? 
In markaby unless you've created some helpers to do otherwise, it 
outputs whatever you write in your code - a call to input() wont be 
transformed in to a textarea or a button or any other kind of form 
element. Markaby really is just a way of writing html, using ruby 
syntax instead of xml/sgml, and not much more.


---
Bluebie

On Tuesday, 13 May 2014 at 3:34 am, Sebastjan Hribar wrote:


But textarea isn't unknown or unspecified type, right?

On 12. 05. 2014 18:19, Bluebie wrote:
All web browsers will treat any unknown or unspecified type of 
input as being a text input. This is why we can have things like 
input type=email and it doesn't destroy everything :)


---
Bluebie

On Tuesday, 13 May 2014 at 1:57 am, Sebastjan Hribar wrote:


Here was my mistake:

I thought that in order for setting the model attribute data like so:

common_attributes = {title: input.title, ..., general_remark: 
input.general_remark}


I have to explicitly state the input tag in the form like so:

input textarea @reviewform.general_remark, rows: 5, name: 
'general_remark'


and this produced the error about tag not allowing the content.

3. Otherwise, I used it like so:

input type: 'textarea', name: 'suggestions_reviewer_comments', 
value: @reviewform.suggestions_reviewer_comments


And this didn't produce any errors, but on the other hand the field 
in the form had the same appearance as the 'text' field.



Thank you again.
regards,
seba

On 12. 05. 2014 15:45, Sebastjan Hribar wrote:
My assumption was based on the behavior of my form in my app. I'll 
test the way magnus wrote it and I'll post back here later today 
so I won't make any false statements.
In order to capture the data I always used the input tag and that 
didn't allow for multiple line textarea.


regards,
seba


2014-05-12 15:08 GMT+02:00 Bartosz Dziewon'ski 
matma@gmail.com mailto:matma@gmail.com:
On Mon, 12 May 2014 14:49:33 +0200, Sebastjan Hribar 
sebastjan.hri...@gmail.com mailto:sebastjan.hri...@gmail.com 
wrote:



I can only use textarea rows:'5' @testform.testing

for displaying pruposes.


Why? textarea is the way to do multiline text inputs in HTML.

--
Matma Rex

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




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




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


___
Camping-list mailing list
Camping-list@rubyforge.org mailto: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

Re: first app - some questions

2014-05-03 Thread Sebastjan Hribar

Hi guys,

just a little feedback from a beginner. I've finished my first camping 
app. Thank you for your help and guidance.


The finished app is about quality management and enables users to fill 
out forms. Based on those forms different quality parameters are 
recorded per user and per project. These can be called up in summary 
reports for desired time frame and user. Along with all the forms for a 
period the average quality evaluation is also displayed. Reports can 
only be generated by quality managers.


I've managed to reuse only one html form for creating, viewing and 
editing. In addition, I've setup the form in such a way, that submitting 
is possible only when the form was called via »new« or »edit« route and 
the user has appropriate authorizations.


I have one question regarding the session. I don't actually know how to 
leverage or use it. According to the reference the session adds states 
to the app. Can someone explain a bit more?


regards,

seba





On 22. 04. 2014 21:27, Magnus Holm wrote:

On Mon, Apr 21, 2014 at 7:32 PM, Sebastjan Hribar
sebastjan.hri...@gmail.com wrote:

Hi,

I've updated the gist with my next version:

https://gist.github.com/sebastjan-hribar/11081389

It works as I wanted but for now I left out the styling.

My question is, is this the correct way of setting up routes?

That looks fine. Although you can even simplify the Index-route like this:

   class Index  # look, no  R '/'
   end


Can someone have a look and point out mistakes I've made. I mean the app
works, but I'd like to know
if (of better yet, how) the routing or anything else can be optimized.

It looks fine to me :-)



Secondly, when I'm done I'll need this to be running in a closed network.
I'd need some advice on deployment. I can run it on a spare machine or a
server even, but how what kind of configuration is required (ports,
databases)...?

If you want to run it on your own machine, I recommend using Phusion
Passenger. Passenger (and other Ruby web server) requires a config.ru
like this:

   $LOAD_PATH  File.expand_path('..')
   require 'review'
   Review.create  # remember to call your #create method here!
   run Review

You can test this config.ru locally using the `rackup` tool:

   $ rackup -p 3301

If this works correctly you should also be able to point Passenger to
the same file and everything should work properly!

You can also deploy using Heroku when you have a working config.ru.

As for configuration, the simplest thing is just checking for an
environment variable in Review.create:

   def Review.create
 case ENV['RACK_ENV']
 when 'production'
   # setup for production
 else
   # setup for development
 end
   end


regards,
seba

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



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

Re: views - html form duplication

2014-04-28 Thread Sebastjan Hribar

Hi,

thank you again for your help.

Firstly, I should apologize for asking something that I could've derived 
from the blog example where partials are well structured and apparent.


Secondly, in the pattern below I couldn't make sense of the 
_post_fields. How is this setup together?


When I implemented

def edit
  form :action = R(PostsNEdit), :method = :post do
_post_fields
  end
end

... I got bad route error.

Then I fixed it by modifying the route like so: R(PostsNEdit, @post) and 
the I got


undefined local variable or method `_post_fields' for 
#Test::Controllers::PostNEdit:0x007f1f95485128.



Anyway, I went back and studied the partials and I've came up with this 
simple test app that works:


https://gist.github.com/sebastjan-hribar/11371787


Another note, in the blog example in the line 96 the update_attributes 
method takes  a hash, but I got an activerecord error, which indicated 
the method needs to have passed in the name and the key: 
@post.update_attribute(:title, input.title).


The app in the gist works by having this implemented.


regards,
seba

P.S.: I'm thinking of putting together a FAQ of all my beginner 
questions and answers provided (or those that I figured out myself). If 
it would be useful I can provide it when finished.



On 24. 04. 2014 22:34, Magnus Holm wrote:

On Thu, Apr 24, 2014 at 10:08 PM, Sebastjan Hribar
sebastjan.hri...@gmail.com wrote:

Hi,

I have a question about duplicating a html form in my views.

To create a new review form in the app I've composed a html form which is a
table and I've ended up with 200+ lines of code due to table row and data
blocks.

This is the input review form for a user to fill out and submit.

My question is about editing an already existing review form. Is there any
way of avoiding the duplication of the html form and reusing the existing
html form? As I understand the inly difference in the edit view is that I
explicitly call the object attributes from the db and represent them in the
input fields. If I can't avoid the duplication I'll end up with another 200+
lines and I should probably then separate my models, views and controllers
into separate files. Right?

This is a common pattern:

   class PostsNew
 def get
   @post = Post.new # new, empty Post-object
   render :new
 end
   end

   class PostsNEdit
 def get(id)
@post = Post.find(id)
render :edit
 end
   end

   module App::Views
 def edit
   form :action = R(PostsNEdit), :method = :post do
 _post_fields
   end
 end

 def new
   form :action = R(Posts), :method = :post do
 _post_fields
   end
 end

 def _form
   input :name = :title, :value = @post.title
 end
   end
___
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


views - html form duplication

2014-04-24 Thread Sebastjan Hribar

Hi,

I have a question about duplicating a html form in my views.

To create a new review form in the app I've composed a html form which 
is a table and I've ended up with 200+ lines of code due to table row 
and data blocks.


This is the input review form for a user to fill out and submit.

My question is about editing an already existing review form. Is there 
any way of avoiding the duplication of the html form and reusing the 
existing html form? As I understand the inly difference in the edit view 
is that I explicitly call the object attributes from the db and 
represent them in the input fields. If I can't avoid the duplication 
I'll end up with another 200+ lines and I should probably then separate 
my models, views and controllers into separate files. Right?


regards,
seba

P.S.: love camping:)
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: views - html form duplication

2014-04-24 Thread Magnus Holm
On Thu, Apr 24, 2014 at 10:08 PM, Sebastjan Hribar
sebastjan.hri...@gmail.com wrote:
 Hi,

 I have a question about duplicating a html form in my views.

 To create a new review form in the app I've composed a html form which is a
 table and I've ended up with 200+ lines of code due to table row and data
 blocks.

 This is the input review form for a user to fill out and submit.

 My question is about editing an already existing review form. Is there any
 way of avoiding the duplication of the html form and reusing the existing
 html form? As I understand the inly difference in the edit view is that I
 explicitly call the object attributes from the db and represent them in the
 input fields. If I can't avoid the duplication I'll end up with another 200+
 lines and I should probably then separate my models, views and controllers
 into separate files. Right?

This is a common pattern:

  class PostsNew
def get
  @post = Post.new # new, empty Post-object
  render :new
end
  end

  class PostsNEdit
def get(id)
   @post = Post.find(id)
   render :edit
end
  end

  module App::Views
def edit
  form :action = R(PostsNEdit), :method = :post do
_post_fields
  end
end

def new
  form :action = R(Posts), :method = :post do
_post_fields
  end
end

def _form
  input :name = :title, :value = @post.title
end
  end
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: first app - some questions

2014-04-23 Thread Sebastjan Hribar

Thank you very much for this valuable information.

And I've stumble upon another problem: migrations.

I want to add additional columns and my table in the database which is 
already set up (this is still development).


I did as it's described in the camping book and put another migration 
with increased version number (I've deleted most columns here for brevity):



  class BasicFields  V 1.0
def self.up
  create_table Reviewform.table_name do |t|
t.string:title
t.string:translator
t.timestamps
  end
end

def self.down
  drop_table Reviewform.table_name
end
  end

  class AdditionalBasicFields  V 1.1
def self.change
  add_column Reviewform.table_name, :wrong_translation, :string
Reviewform.reset_column_information
end

def self.down
  drop_table Reviewform.table_name
end
  end
---


And at the end of the file I have as usual:
---
def Review.create
  Review::Models.create_schema
end
--

This throws this error at me when creating a new form:

ActiveRecord::UnknownAttributeError at /form/new

unknown attribute: wrong_translation
Ruby 
/home/sebastjan/.rvm/gems/ruby-2.1.1/gems/activerecord-4.0.4/lib/active_record/attribute_assignment.rb: 
in rescue in _assign_attribute, line 47


WebPOST localhost/form/new


I also tried doing this as described in ActiveRecord API:

  class AdditionalBasicFields  V 1.1

def self.change
  change_table :reviewforms do |t|
t.integer :wrong_translation
  end
end

def self.down
  drop_table Reviewform.table_name
end

  end
--

And I get the same error. The table is not changed.

I can't find the mistake I've made.

Need help:(
regards,
seba

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


Re: first app - some questions

2014-04-22 Thread Magnus Holm
On Mon, Apr 21, 2014 at 7:32 PM, Sebastjan Hribar
sebastjan.hri...@gmail.com wrote:
 Hi,

 I've updated the gist with my next version:

 https://gist.github.com/sebastjan-hribar/11081389

 It works as I wanted but for now I left out the styling.

 My question is, is this the correct way of setting up routes?

That looks fine. Although you can even simplify the Index-route like this:

  class Index  # look, no  R '/'
  end

 Can someone have a look and point out mistakes I've made. I mean the app
 works, but I'd like to know
 if (of better yet, how) the routing or anything else can be optimized.

It looks fine to me :-)


 Secondly, when I'm done I'll need this to be running in a closed network.
 I'd need some advice on deployment. I can run it on a spare machine or a
 server even, but how what kind of configuration is required (ports,
 databases)...?

If you want to run it on your own machine, I recommend using Phusion
Passenger. Passenger (and other Ruby web server) requires a config.ru
like this:

  $LOAD_PATH  File.expand_path('..')
  require 'review'
  Review.create  # remember to call your #create method here!
  run Review

You can test this config.ru locally using the `rackup` tool:

  $ rackup -p 3301

If this works correctly you should also be able to point Passenger to
the same file and everything should work properly!

You can also deploy using Heroku when you have a working config.ru.

As for configuration, the simplest thing is just checking for an
environment variable in Review.create:

  def Review.create
case ENV['RACK_ENV']
when 'production'
  # setup for production
else
  # setup for development
end
  end

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


Re: first app - some questions

2014-04-21 Thread Sebastjan Hribar

Hi,

I've updated the gist with my next version:

https://gist.github.com/sebastjan-hribar/11081389

It works as I wanted but for now I left out the styling.

My question is, is this the correct way of setting up routes?
Can someone have a look and point out mistakes I've made. I mean the app 
works, but I'd like to know

if (of better yet, how) the routing or anything else can be optimized.

Secondly, when I'm done I'll need this to be running in a closed 
network. I'd need some advice on deployment. I can run it on a spare 
machine or a server even, but how what kind of configuration is required 
(ports, databases)...?


regards,
seba


On 19. 04. 2014 13:22, Sebastjan Hribar wrote:

Hi,

I have a couple of questions:

1. What is the difference between these two ways of setting up migrations:

1.1 example from the camping book:
-
|class BasicFields  V 1.0|
|||def self.up| |||create_table Page.table_name do |t|| |.| |.| |.|
-


1.2 Example from the blog example:

 class BasicFields  V 1.1
  def self.up
create_table :blog_posts, :force = true do |t|
---

Why the difference between Model.table_name and :campingapp_model 
and which one should I use?



2. UTF-8 encoding doesn't work. Special characters like c(, s(, z( 
from my language are not displayed. Should I force the encoding and how?


3. Here is the link to the gist where I've posted my first camping app 
skeleton for the quality reporting app I need to do. I'd really 
appreciate it if someone can have a look and just tell me if I'm on 
the right track with the understanding of the camping concept.


https://gist.github.com/sebastjan-hribar/11081389

...and Happy Easter!
seba




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

Re: first app - some questions

2014-04-19 Thread Bartosz Dziewoński

On Sat, 19 Apr 2014 13:22:52 +0200, Sebastjan Hribar 
sebastjan.hri...@gmail.com wrote:


2. UTF-8 encoding doesn't work. Special characters like č, š, ž from my 
language are not displayed. Should I force the encoding and how?


You need to do two things:

a) Ensure that the source text is, in fact, encoded in UTF-8. Your editor 
should provide a way to change the encoding used, most sane ones use UTF-8 by 
default nowadays, though.

b) Ensure that a 'meta charset=UTF-8 /' tag (or equivalent, there are many 
variants, all of which work) is present on the HTML output of your application. Otherwise 
browsers try to guess the encoding used and usually get it wrong.


Looking at the source code you linked, you have the following in the `layout` 
method:

html do
  title 'Aplikacija za dvojezične obrazce'
  body do
self  yield
  end
end

This should probably be:

html do
  head do
title 'Aplikacija za dvojezične obrazce'
  end
  body do
self  yield
  end
end

I *think* the latest mab adds the meta tag I mentioned automatically if you 
call `head`, but I'm not entirely sure – just check :), and if it doesn't, add `meta 
charset: 'UTF-8'` just after `head do` yourself.

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

camping tutorial pre-2

2014-04-16 Thread Sebastjan Hribar
Hi Guys,

I found this pre-2 tutorial on the ruby-camping-links.1.ai site:
http://polzr.blogspot.com/2007/04/everythinginject-sum-post-sum-post-ii.html?view=timeslide

I've gone through the code and typed it out to learn, but when I run the
app I get the message

/ not found

I've also copied the code as I might mistyped something and the result is
the same.

Any ideas?

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

Re: camping tutorial pre-2

2014-04-16 Thread Magnus Holm
Do you have the exact code you've entered? You can use
https://gist.github.com/ to share it.

// Magnus Holm


On Wed, Apr 16, 2014 at 1:14 PM, Sebastjan Hribar
sebastjan.hri...@gmail.com wrote:
 Hi Guys,

 I found this pre-2 tutorial on the ruby-camping-links.1.ai site:
 http://polzr.blogspot.com/2007/04/everythinginject-sum-post-sum-post-ii.html?view=timeslide

 I've gone through the code and typed it out to learn, but when I run the app
 I get the message

 / not found

 I've also copied the code as I might mistyped something and the result is
 the same.

 Any ideas?

 regards
 seba

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


Re: camping tutorial pre-2

2014-04-16 Thread Sebastjan Hribar
Hi,

here is the gist: https://gist.github.com/anonymous/10878521

As a side note: I don't get replies to my mail box eventhoug I've
subscribed to the mailing list.

regards,
seba


2014-04-16 13:14 GMT+02:00 Sebastjan Hribar sebastjan.hri...@gmail.com:

 Hi Guys,

 I found this pre-2 tutorial on the ruby-camping-links.1.ai site:

 http://polzr.blogspot.com/2007/04/everythinginject-sum-post-sum-post-ii.html?view=timeslide

 I've gone through the code and typed it out to learn, but when I run the
 app I get the message

 / not found

 I've also copied the code as I might mistyped something and the result is
 the same.

 Any ideas?

 regards
 seba

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

first project - relevance

2014-03-31 Thread Sebastjan Hribar

Hi,

Hopefully this mail wont duplicate as I've sent out one before I got the 
confirmation for subscription:)


Here the original message:

I'm new to camping, but not to ruby and I know about rails, but I've 
never used it apart from the learning blog app.
I'm inspired by why's work as I use Shoes a lot and I was blown when I 
first saw camping.


I really want to start using it and I'd like to ask you guys if my first 
learning project is suitable for camping.


I need to make a webapp for quality control checks. I'd have 1 form and 
multiple users. In addition, some querying among forms would be needed 
to get the data about quality per product or user.


To my understanding I could use camping for this and I don't have to use 
rails or something else. Am I correct?


Kind regards,
seba
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


first project - relevance

2014-03-31 Thread Sebastjan Hribar

Hi,

I'm new to camping, but not to ruby and I know about rails, but I've 
never used it apart from the learning blog app.
I'm inspired by why's work as I use Shoes a lot and I was blown when I 
first saw camping.


I really want to start using it and I'd like to ask you guys if my first 
learning project is suitable for camping.


I need to make a webapp for quality control checks. I'd have 1 form and 
multiple users. In addition, some querying among forms would be needed 
to get the data about quality per product or user.


To my understanding I could use camping for this and I don't have to use 
rails or something else. Am I correct?


Kind regards,
seba
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: first project - relevance

2014-03-31 Thread David C gurugeek

On Mar 31, 2014, at 6:45 PM, Sebastjan Hribar sebastjan.hri...@gmail.com 
 
 I need to make a webapp for quality control checks. I'd have 1 form and 
 multiple users. In addition, some querying among forms would be needed to get 
 the data about quality per product or user.
 
 To my understanding I could use camping for this and I don't have to use 
 rails or something else. Am I correct?

Hello Seba and welcome to Camping,
yes you can. If you know rails you will find many similarity in camping without 
the complexities of a rail app. Just give it a try and you won't be 
disappointed :) all the rails developers I worked with found it very easy to 
migrate projects/concepts to camping.
David
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Mab::Mixin::Error This tag is already closed

2014-01-24 Thread Francois Sery
Bonjour,
it's me again. Deploying a camping app on amazon ec2 i have a
Mab::Mixin::Error at /admin/personnes This tag is already closed

the app works fine on my local machine but not on ec2(just the same as my
last message!). The mab gem version number  is the same so i have no idea
of what it could be. Any idea ?

Merci






Traceback (innermost first)

   - /usr/share/ruby/1.9/gems/1.9.1/gems/mab-0.0.3/lib/mab/mixin.rb: in
   _insert
   1. raise Error, This tag is already closed if @_done...
- /usr/share/ruby/1.9/gems/1.9.1/gems/mab-0.0.3/lib/mab/mixin.rb: in
   method_missing
   1. _insert(*args, blk)...
- (eval): in mab_done
   - /usr/share/ruby/1.9/gems/1.9.1/gems/mab-0.0.3/lib/mab/mixin.rb: in
   _insert
   1. @_instance.mab_done(self) if @_done...
- (eval): in a
   - ressource_personne.rb: in personnes_list
   1. a Nouveau personnes, :class= btn btn-mini btn-primary, :href =
  R(AdminPersonnesCreate)...
- main: in block in render
   - /usr/share/ruby/1.9/gems/1.9.1/gems/mab-0.0.3/lib/mab/mixin.rb: in
   instance_eval
   1. res = instance_eval(blk)...
- /usr/share/ruby/1.9/gems/1.9.1/gems/mab-0.0.3/lib/mab/mixin.rb: in mab
   1. res = instance_eval(blk)...
- main: in mab
   - main: in render
   - ressource_personne.rb: in get
   1. render :personnes_list...
- main: in block in service
   - main: in catch
   - main: in service
   - /var/app/current/app.rb: in service
   1. super...
- main: in call
   -
   /usr/share/ruby/1.9/gems/1.9.1/gems/rack-1.5.2/lib/rack/showexceptions.rb:
   in call
   1. @app.call(env)...
-
   
/usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/lib/phusion_passenger/rack/thread_handler_extension.rb:
   in process_request
   1. status, headers, body = @app.call(env)...
-
   
/usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/lib/phusion_passenger/request_handler/thread_handler.rb:
   in accept_and_process_next_request
   1. process_request(headers, connection, socket_wrapper, @protocol ==
  :http)...
-
   
/usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/lib/phusion_passenger/request_handler/thread_handler.rb:
   in main_loop
   1. hijacked = accept_and_process_next_request(socket_wrapper, channel,
  buffer)...
-
   
/usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/lib/phusion_passenger/request_handler.rb:
   in block (3 levels) in start_threads
   1. handler.main_loop(set_initialization_state_to_true)
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: Mab::Mixin::Error This tag is already closed

2014-01-24 Thread Magnus Holm
Interesting. Could you post the personnes_list template?

// Magnus Holm


On Fri, Jan 24, 2014 at 12:51 PM, Francois Sery sery.franc...@gmail.com wrote:
 Bonjour,
 it's me again. Deploying a camping app on amazon ec2 i have a

 Mab::Mixin::Error at /admin/personnes

 This tag is already closed

 the app works fine on my local machine but not on ec2(just the same as my
 last message!). The mab gem version number  is the same so i have no idea of
 what it could be. Any idea ?

 Merci






 Traceback (innermost first)

 /usr/share/ruby/1.9/gems/1.9.1/gems/mab-0.0.3/lib/mab/mixin.rb: in _insert

 raise Error, This tag is already closed if @_done...

 /usr/share/ruby/1.9/gems/1.9.1/gems/mab-0.0.3/lib/mab/mixin.rb: in
 method_missing

 _insert(*args, blk)...

 (eval): in mab_done
 /usr/share/ruby/1.9/gems/1.9.1/gems/mab-0.0.3/lib/mab/mixin.rb: in _insert

 @_instance.mab_done(self) if @_done...

 (eval): in a
 ressource_personne.rb: in personnes_list

 a Nouveau personnes, :class= btn btn-mini btn-primary, :href =
 R(AdminPersonnesCreate)...

 main: in block in render
 /usr/share/ruby/1.9/gems/1.9.1/gems/mab-0.0.3/lib/mab/mixin.rb: in
 instance_eval

 res = instance_eval(blk)...

 /usr/share/ruby/1.9/gems/1.9.1/gems/mab-0.0.3/lib/mab/mixin.rb: in mab

 res = instance_eval(blk)...

 main: in mab
 main: in render
 ressource_personne.rb: in get

 render :personnes_list...

 main: in block in service
 main: in catch
 main: in service
 /var/app/current/app.rb: in service

 super...

 main: in call
 /usr/share/ruby/1.9/gems/1.9.1/gems/rack-1.5.2/lib/rack/showexceptions.rb:
 in call

 @app.call(env)...

 /usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/lib/phusion_passenger/rack/thread_handler_extension.rb:
 in process_request

 status, headers, body = @app.call(env)...

 /usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/lib/phusion_passenger/request_handler/thread_handler.rb:
 in accept_and_process_next_request

 process_request(headers, connection, socket_wrapper, @protocol == :http)...

 /usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/lib/phusion_passenger/request_handler/thread_handler.rb:
 in main_loop

 hijacked = accept_and_process_next_request(socket_wrapper, channel,
 buffer)...

 /usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/lib/phusion_passenger/request_handler.rb:
 in block (3 levels) in start_threads

 handler.main_loop(set_initialization_state_to_true)



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


Re: Mab::Mixin::Error This tag is already closed

2014-01-24 Thread Francois Sery
here is  the view. i don't know if it is important but the file  containig
this code is loaded from another file.


def personnes_list
h1 Toute les personnes
a ''Nouvelle personnes'', :class= ''btn btn-mini btn-primary'',
:href = R(AdminPersonnesCreate)

table :class =table do
@personnes.each do |personne|
tr do
td personne.id
td {b personne.nom }
td {a voir,:class= btn btn-mini btn-primary, :href
= R(AdminPersonnesX, personne.id)
 }
td {a supprimer,:class= btn btn-mini btn-primary,
:href = R(AdminPersonnesDeleteX, personne.id)
}
td {a modifier,:class= btn btn-mini btn-primary,
:href = R(AdminPersonnesUpdateX, personne.id)
}
end
end

end

end


2014/1/24 Magnus Holm judo...@gmail.com

 Interesting. Could you post the personnes_list template?

 // Magnus Holm


 On Fri, Jan 24, 2014 at 12:51 PM, Francois Sery sery.franc...@gmail.com
 wrote:
  Bonjour,
  it's me again. Deploying a camping app on amazon ec2 i have a
 
  Mab::Mixin::Error at /admin/personnes
 
  This tag is already closed
 
  the app works fine on my local machine but not on ec2(just the same as my
  last message!). The mab gem version number  is the same so i have no
 idea of
  what it could be. Any idea ?
 
  Merci
 
 
 
 
 
 
  Traceback (innermost first)
 
  /usr/share/ruby/1.9/gems/1.9.1/gems/mab-0.0.3/lib/mab/mixin.rb: in
 _insert
 
  raise Error, This tag is already closed if @_done...
 
  /usr/share/ruby/1.9/gems/1.9.1/gems/mab-0.0.3/lib/mab/mixin.rb: in
  method_missing
 
  _insert(*args, blk)...
 
  (eval): in mab_done
  /usr/share/ruby/1.9/gems/1.9.1/gems/mab-0.0.3/lib/mab/mixin.rb: in
 _insert
 
  @_instance.mab_done(self) if @_done...
 
  (eval): in a
  ressource_personne.rb: in personnes_list
 
  a Nouveau personnes, :class= btn btn-mini btn-primary, :href =
  R(AdminPersonnesCreate)...
 
  main: in block in render
  /usr/share/ruby/1.9/gems/1.9.1/gems/mab-0.0.3/lib/mab/mixin.rb: in
  instance_eval
 
  res = instance_eval(blk)...
 
  /usr/share/ruby/1.9/gems/1.9.1/gems/mab-0.0.3/lib/mab/mixin.rb: in mab
 
  res = instance_eval(blk)...
 
  main: in mab
  main: in render
  ressource_personne.rb: in get
 
  render :personnes_list...
 
  main: in block in service
  main: in catch
  main: in service
  /var/app/current/app.rb: in service
 
  super...
 
  main: in call
 
 /usr/share/ruby/1.9/gems/1.9.1/gems/rack-1.5.2/lib/rack/showexceptions.rb:
  in call
 
  @app.call(env)...
 
 
 /usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/lib/phusion_passenger/rack/thread_handler_extension.rb:
  in process_request
 
  status, headers, body = @app.call(env)...
 
 
 /usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/lib/phusion_passenger/request_handler/thread_handler.rb:
  in accept_and_process_next_request
 
  process_request(headers, connection, socket_wrapper, @protocol ==
 :http)...
 
 
 /usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/lib/phusion_passenger/request_handler/thread_handler.rb:
  in main_loop
 
  hijacked = accept_and_process_next_request(socket_wrapper, channel,
  buffer)...
 
 
 /usr/share/ruby/1.9/gems/1.9.1/gems/passenger-4.0.20/lib/phusion_passenger/request_handler.rb:
  in block (3 levels) in start_threads
 
  handler.main_loop(set_initialization_state_to_true)
 
 
 
  ___
  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

Re: camping app on elastic beanstalk

2014-01-22 Thread Francois Sery
Thanks for your help: it works !
I thought that the app.create  was automatically called...but i was wrong.
now i call the create methOd from config.ru. i don't know if it is the best
solution... but it works.

Francois


2014/1/17 Tim Uckun timuc...@gmail.com

 If you run the migrations it should create the database for you.


 On Sat, Jan 18, 2014 at 3:46 AM, arca0 arcaz...@gmail.com wrote:

 ok, I'm an absolute newbie myself so I'm just guessing away here, but
 since nobody else is responding, here goes ;D

 I can't see a single line of code that would be responsible for creating
 the db file. Is the app.db file in your project directory on the instance?
 If not, can you try copying it from the local environment to see if it
 fixes the problem?
 Also, are you sure sqlite3 gem has built native extensions properly?

 You really got me curious here ;D Please be sure to let me know if you
 manage to solve the problem :)


 On 17 January 2014 11:35, Francois Sery sery.franc...@gmail.com wrote:

 yes ! the answer is 3.6.20


 2014/1/17 arca0 arcaz...@gmail.com

 does your elastic beanstalk instance have sqlite3 installed? can you
 run sqlite3 --version on it?


 On 17 January 2014 09:07, Francois Sery sery.franc...@gmail.comwrote:

 Bonjour,
  here is my app code and  the trace. thanks for your help.



 #app.rb
 require 'camping'
 require 'sqlite3'

 Camping.goes :App



  module App::Models
  #models


 class Personne  Base

 end

  #migrations

 class BasicFields  V 1.0
 def self.up
 create_table Personne.table_name do |t|
 t.string :nom
 t.text :prenom
 t.timestamps

 end

 end

 def self.down
 drop_table Personne.table_name

 end


 end


  end

 module App::Controllers
 class Index
 def get

 @env.inspect
 end
 end
 class Create
 def get
 Personne.create :nom = 'super', :prenom ='man'
 redirect R(Index)

 end
 end
 end


 def App.create

 App::Models::Base.establish_connection(
 :adapter ='sqlite3',
 :database = 'app.db'

 )

 end


 #
 and the trace (546)

-

 /usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:
in retrieve_connection
1.
   2. # Locate the connection of the nearest super class. This can
   be an
   3. # active or defined connection: if it is the latter, it will
   be
   4. # opened and set as the active connection for the class it
   was defined
   5. # for (not necessarily the current class).
   6. def retrieve_connection(klass) #:nodoc:
   7. pool = retrieve_connection_pool(klass)
1. (pool  pool.connection) or raise ConnectionNotEstablished...
1. end
   2.
   3. # Returns true if a connection that's accessible to this
   class has
   4. # already been opened.
   5. def connected?(klass)
   6. conn = retrieve_connection_pool(klass)
   7. conn  conn.connected?





 2014/1/15 arca0 arcaz...@gmail.com

 Hi Francois,
 it looks like your db configuration is somehow wrong. Care to submit
 more information about that? How does your db config look?
 alex

 From: Francois Sery sery.franc...@gmail.com
 Date: 15 January 2014 08:10
 Subject: camping app on elastic beanstalk
 To: camping-list@rubyforge.org



 Bonjour les Campers,
  i need help deploying a camping app on  AWS  with elastic beanstalk.
  i can run a simple hello camping app with do database and only
 one controller on elasticbeanstalk.But when i add  migration, model 
 ,schema
 creation and update the  gemfile   it doesn't work anymore.
  the app works fine on my local machine but not on beanstalk .I dont
 understand  what is different from my local machine ?
 Its the first time I deploy  an app so every advices are welcome.
 here is the message from the log

 *** Exception ActiveRecord::ConnectionNotEstablished in Rack 
 application object (ActiveRecord::ConnectionNotEstablished)









 Thanks



 ___
 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



 ___
 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 

Re: camping app on elastic beanstalk

2014-01-17 Thread Francois Sery
Bonjour,
 here is my app code and  the trace. thanks for your help.



#app.rb
require 'camping'
require 'sqlite3'

Camping.goes :App



 module App::Models
 #models


class Personne  Base

end

 #migrations

class BasicFields  V 1.0
def self.up
create_table Personne.table_name do |t|
t.string :nom
t.text :prenom
t.timestamps

end

end

def self.down
drop_table Personne.table_name

end


end


 end

module App::Controllers
class Index
def get

@env.inspect
end
end
class Create
def get
Personne.create :nom = 'super', :prenom ='man'
redirect R(Index)

end
end
end


def App.create

App::Models::Base.establish_connection(
:adapter ='sqlite3',
:database = 'app.db'

)

end


#
and the trace (546)

   -
   
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:
   in retrieve_connection
   1.
  2. # Locate the connection of the nearest super class. This can be an
  3. # active or defined connection: if it is the latter, it will be
  4. # opened and set as the active connection for the class it was
  defined
  5. # for (not necessarily the current class).
  6. def retrieve_connection(klass) #:nodoc:
  7. pool = retrieve_connection_pool(klass)
   1. (pool  pool.connection) or raise ConnectionNotEstablished...
   1. end
  2.
  3. # Returns true if a connection that's accessible to this class has
  4. # already been opened.
  5. def connected?(klass)
  6. conn = retrieve_connection_pool(klass)
  7. conn  conn.connected?





2014/1/15 arca0 arcaz...@gmail.com

 Hi Francois,
 it looks like your db configuration is somehow wrong. Care to submit more
 information about that? How does your db config look?
 alex

 From: Francois Sery sery.franc...@gmail.com
 Date: 15 January 2014 08:10
 Subject: camping app on elastic beanstalk
 To: camping-list@rubyforge.org



 Bonjour les Campers,
  i need help deploying a camping app on  AWS  with elastic beanstalk.
  i can run a simple hello camping app with do database and only one
 controller on elasticbeanstalk.But when i add  migration, model ,schema
 creation and update the  gemfile   it doesn't work anymore.
  the app works fine on my local machine but not on beanstalk .I dont
 understand  what is different from my local machine ?
 Its the first time I deploy  an app so every advices are welcome.
 here is the message from the log

 *** Exception ActiveRecord::ConnectionNotEstablished in Rack application 
 object (ActiveRecord::ConnectionNotEstablished)




 Thanks



 ___
 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

Re: camping app on elastic beanstalk

2014-01-17 Thread arca0
does your elastic beanstalk instance have sqlite3 installed? can you
run sqlite3
--version on it?


On 17 January 2014 09:07, Francois Sery sery.franc...@gmail.com wrote:

 Bonjour,
  here is my app code and  the trace. thanks for your help.



 #app.rb
 require 'camping'
 require 'sqlite3'

 Camping.goes :App



  module App::Models
  #models


 class Personne  Base

 end

  #migrations

 class BasicFields  V 1.0
 def self.up
 create_table Personne.table_name do |t|
 t.string :nom
 t.text :prenom
 t.timestamps

 end

 end

 def self.down
 drop_table Personne.table_name

 end


 end


  end

 module App::Controllers
 class Index
 def get

 @env.inspect
 end
 end
 class Create
 def get
 Personne.create :nom = 'super', :prenom ='man'
 redirect R(Index)

 end
 end
 end


 def App.create

 App::Models::Base.establish_connection(
 :adapter ='sqlite3',
 :database = 'app.db'

 )

 end


 #
 and the trace (546)

-

 /usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:
in retrieve_connection
1.
   2. # Locate the connection of the nearest super class. This can be
   an
   3. # active or defined connection: if it is the latter, it will be
   4. # opened and set as the active connection for the class it was
   defined
   5. # for (not necessarily the current class).
   6. def retrieve_connection(klass) #:nodoc:
   7. pool = retrieve_connection_pool(klass)
1. (pool  pool.connection) or raise ConnectionNotEstablished...
1. end
   2.
   3. # Returns true if a connection that's accessible to this class
   has
   4. # already been opened.
   5. def connected?(klass)
   6. conn = retrieve_connection_pool(klass)
   7. conn  conn.connected?





 2014/1/15 arca0 arcaz...@gmail.com

 Hi Francois,
 it looks like your db configuration is somehow wrong. Care to submit more
 information about that? How does your db config look?
 alex

 From: Francois Sery sery.franc...@gmail.com
 Date: 15 January 2014 08:10
 Subject: camping app on elastic beanstalk
 To: camping-list@rubyforge.org



 Bonjour les Campers,
  i need help deploying a camping app on  AWS  with elastic beanstalk.
  i can run a simple hello camping app with do database and only one
 controller on elasticbeanstalk.But when i add  migration, model ,schema
 creation and update the  gemfile   it doesn't work anymore.
  the app works fine on my local machine but not on beanstalk .I dont
 understand  what is different from my local machine ?
 Its the first time I deploy  an app so every advices are welcome.
 here is the message from the log

 *** Exception ActiveRecord::ConnectionNotEstablished in Rack application 
 object (ActiveRecord::ConnectionNotEstablished)





 Thanks



 ___
 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

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

Re: camping app on elastic beanstalk

2014-01-17 Thread Francois Sery
yes ! the answer is 3.6.20


2014/1/17 arca0 arcaz...@gmail.com

 does your elastic beanstalk instance have sqlite3 installed? can you run 
 sqlite3
 --version on it?


 On 17 January 2014 09:07, Francois Sery sery.franc...@gmail.com wrote:

 Bonjour,
  here is my app code and  the trace. thanks for your help.



 #app.rb
 require 'camping'
 require 'sqlite3'

 Camping.goes :App



  module App::Models
  #models


 class Personne  Base

 end

  #migrations

 class BasicFields  V 1.0
 def self.up
 create_table Personne.table_name do |t|
 t.string :nom
 t.text :prenom
 t.timestamps

 end

 end

 def self.down
 drop_table Personne.table_name

 end


 end


  end

 module App::Controllers
 class Index
 def get

 @env.inspect
 end
 end
 class Create
 def get
 Personne.create :nom = 'super', :prenom ='man'
 redirect R(Index)

 end
 end
 end


 def App.create

 App::Models::Base.establish_connection(
 :adapter ='sqlite3',
 :database = 'app.db'

 )

 end


 #
 and the trace (546)

-

 /usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:
in retrieve_connection
1.
   2. # Locate the connection of the nearest super class. This can be
   an
   3. # active or defined connection: if it is the latter, it will be
   4. # opened and set as the active connection for the class it was
   defined
   5. # for (not necessarily the current class).
   6. def retrieve_connection(klass) #:nodoc:
   7. pool = retrieve_connection_pool(klass)
1. (pool  pool.connection) or raise ConnectionNotEstablished...
1. end
   2.
   3. # Returns true if a connection that's accessible to this class
   has
   4. # already been opened.
   5. def connected?(klass)
   6. conn = retrieve_connection_pool(klass)
   7. conn  conn.connected?





 2014/1/15 arca0 arcaz...@gmail.com

 Hi Francois,
 it looks like your db configuration is somehow wrong. Care to submit
 more information about that? How does your db config look?
 alex

 From: Francois Sery sery.franc...@gmail.com
 Date: 15 January 2014 08:10
 Subject: camping app on elastic beanstalk
 To: camping-list@rubyforge.org



 Bonjour les Campers,
  i need help deploying a camping app on  AWS  with elastic beanstalk.
  i can run a simple hello camping app with do database and only one
 controller on elasticbeanstalk.But when i add  migration, model ,schema
 creation and update the  gemfile   it doesn't work anymore.
  the app works fine on my local machine but not on beanstalk .I dont
 understand  what is different from my local machine ?
 Its the first time I deploy  an app so every advices are welcome.
 here is the message from the log

 *** Exception ActiveRecord::ConnectionNotEstablished in Rack application 
 object (ActiveRecord::ConnectionNotEstablished)






 Thanks



 ___
 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



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

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

Re: camping app on elastic beanstalk

2014-01-17 Thread arca0
ok, I'm an absolute newbie myself so I'm just guessing away here, but since
nobody else is responding, here goes ;D

I can't see a single line of code that would be responsible for creating
the db file. Is the app.db file in your project directory on the instance?
If not, can you try copying it from the local environment to see if it
fixes the problem?
Also, are you sure sqlite3 gem has built native extensions properly?

You really got me curious here ;D Please be sure to let me know if you
manage to solve the problem :)


On 17 January 2014 11:35, Francois Sery sery.franc...@gmail.com wrote:

 yes ! the answer is 3.6.20


 2014/1/17 arca0 arcaz...@gmail.com

 does your elastic beanstalk instance have sqlite3 installed? can you run 
 sqlite3
 --version on it?


 On 17 January 2014 09:07, Francois Sery sery.franc...@gmail.com wrote:

 Bonjour,
  here is my app code and  the trace. thanks for your help.



 #app.rb
 require 'camping'
 require 'sqlite3'

 Camping.goes :App



  module App::Models
  #models


 class Personne  Base

 end

  #migrations

 class BasicFields  V 1.0
 def self.up
 create_table Personne.table_name do |t|
 t.string :nom
 t.text :prenom
 t.timestamps

 end

 end

 def self.down
 drop_table Personne.table_name

 end


 end


  end

 module App::Controllers
 class Index
 def get

 @env.inspect
 end
 end
 class Create
 def get
 Personne.create :nom = 'super', :prenom ='man'
 redirect R(Index)

 end
 end
 end


 def App.create

 App::Models::Base.establish_connection(
 :adapter ='sqlite3',
 :database = 'app.db'

 )

 end


 #
 and the trace (546)

-

 /usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:
in retrieve_connection
1.
   2. # Locate the connection of the nearest super class. This can
   be an
   3. # active or defined connection: if it is the latter, it will
   be
   4. # opened and set as the active connection for the class it was
   defined
   5. # for (not necessarily the current class).
   6. def retrieve_connection(klass) #:nodoc:
   7. pool = retrieve_connection_pool(klass)
1. (pool  pool.connection) or raise ConnectionNotEstablished...
1. end
   2.
   3. # Returns true if a connection that's accessible to this class
   has
   4. # already been opened.
   5. def connected?(klass)
   6. conn = retrieve_connection_pool(klass)
   7. conn  conn.connected?





 2014/1/15 arca0 arcaz...@gmail.com

 Hi Francois,
 it looks like your db configuration is somehow wrong. Care to submit
 more information about that? How does your db config look?
 alex

 From: Francois Sery sery.franc...@gmail.com
 Date: 15 January 2014 08:10
 Subject: camping app on elastic beanstalk
 To: camping-list@rubyforge.org



 Bonjour les Campers,
  i need help deploying a camping app on  AWS  with elastic beanstalk.
  i can run a simple hello camping app with do database and only one
 controller on elasticbeanstalk.But when i add  migration, model ,schema
 creation and update the  gemfile   it doesn't work anymore.
  the app works fine on my local machine but not on beanstalk .I dont
 understand  what is different from my local machine ?
 Its the first time I deploy  an app so every advices are welcome.
 here is the message from the log

 *** Exception ActiveRecord::ConnectionNotEstablished in Rack application 
 object (ActiveRecord::ConnectionNotEstablished)







 Thanks



 ___
 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



 ___
 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

Re: camping app on elastic beanstalk

2014-01-17 Thread Magnus Holm
Do you actually call App.create? Camping will not do this for you
automatically (unless you're using the Camping Server, aka
bin/camping).

// Magnus Holm


On Fri, Jan 17, 2014 at 9:07 AM, Francois Sery sery.franc...@gmail.com wrote:
 Bonjour,
  here is my app code and  the trace. thanks for your help.



 #app.rb
 require 'camping'
 require 'sqlite3'

 Camping.goes :App



  module App::Models
  #models


 class Personne  Base

 end

  #migrations

 class BasicFields  V 1.0
 def self.up
 create_table Personne.table_name do |t|
 t.string :nom
 t.text :prenom
 t.timestamps

 end

 end

 def self.down
 drop_table Personne.table_name

 end


 end


  end

 module App::Controllers
 class Index
 def get

 @env.inspect
 end
 end
 class Create
 def get
 Personne.create :nom = 'super', :prenom ='man'
 redirect R(Index)

 end
 end
 end


 def App.create

 App::Models::Base.establish_connection(
 :adapter ='sqlite3',
 :database = 'app.db'

 )

 end


 #
 and the trace (546)

 /usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:
 in retrieve_connection


 # Locate the connection of the nearest super class. This can be an
 # active or defined connection: if it is the latter, it will be
 # opened and set as the active connection for the class it was defined
 # for (not necessarily the current class).
 def retrieve_connection(klass) #:nodoc:
 pool = retrieve_connection_pool(klass)

 (pool  pool.connection) or raise ConnectionNotEstablished...

 end

 # Returns true if a connection that's accessible to this class has
 # already been opened.
 def connected?(klass)
 conn = retrieve_connection_pool(klass)
 conn  conn.connected?





 2014/1/15 arca0 arcaz...@gmail.com

 Hi Francois,
 it looks like your db configuration is somehow wrong. Care to submit more
 information about that? How does your db config look?
 alex

 From: Francois Sery sery.franc...@gmail.com
 Date: 15 January 2014 08:10
 Subject: camping app on elastic beanstalk
 To: camping-list@rubyforge.org



 Bonjour les Campers,
 i need help deploying a camping app on  AWS  with elastic beanstalk.
  i can run a simple hello camping app with do database and only one
 controller on elasticbeanstalk.But when i add  migration, model ,schema
 creation and update the  gemfile   it doesn't work anymore.
  the app works fine on my local machine but not on beanstalk .I dont
 understand  what is different from my local machine ?
 Its the first time I deploy  an app so every advices are welcome.
 here is the message from the log

 *** Exception ActiveRecord::ConnectionNotEstablished in Rack application
 object (ActiveRecord::ConnectionNotEstablished)






 Thanks



 ___
 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
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: camping app on elastic beanstalk

2014-01-17 Thread Tim Uckun
If you run the migrations it should create the database for you.


On Sat, Jan 18, 2014 at 3:46 AM, arca0 arcaz...@gmail.com wrote:

 ok, I'm an absolute newbie myself so I'm just guessing away here, but
 since nobody else is responding, here goes ;D

 I can't see a single line of code that would be responsible for creating
 the db file. Is the app.db file in your project directory on the instance?
 If not, can you try copying it from the local environment to see if it
 fixes the problem?
 Also, are you sure sqlite3 gem has built native extensions properly?

 You really got me curious here ;D Please be sure to let me know if you
 manage to solve the problem :)


 On 17 January 2014 11:35, Francois Sery sery.franc...@gmail.com wrote:

 yes ! the answer is 3.6.20


 2014/1/17 arca0 arcaz...@gmail.com

 does your elastic beanstalk instance have sqlite3 installed? can you run 
 sqlite3
 --version on it?


 On 17 January 2014 09:07, Francois Sery sery.franc...@gmail.com wrote:

 Bonjour,
  here is my app code and  the trace. thanks for your help.



 #app.rb
 require 'camping'
 require 'sqlite3'

 Camping.goes :App



  module App::Models
  #models


 class Personne  Base

 end

  #migrations

 class BasicFields  V 1.0
 def self.up
 create_table Personne.table_name do |t|
 t.string :nom
 t.text :prenom
 t.timestamps

 end

 end

 def self.down
 drop_table Personne.table_name

 end


 end


  end

 module App::Controllers
 class Index
 def get

 @env.inspect
 end
 end
 class Create
 def get
 Personne.create :nom = 'super', :prenom ='man'
 redirect R(Index)

 end
 end
 end


 def App.create

 App::Models::Base.establish_connection(
 :adapter ='sqlite3',
 :database = 'app.db'

 )

 end


 #
 and the trace (546)

-

 /usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:
in retrieve_connection
1.
   2. # Locate the connection of the nearest super class. This can
   be an
   3. # active or defined connection: if it is the latter, it will
   be
   4. # opened and set as the active connection for the class it
   was defined
   5. # for (not necessarily the current class).
   6. def retrieve_connection(klass) #:nodoc:
   7. pool = retrieve_connection_pool(klass)
1. (pool  pool.connection) or raise ConnectionNotEstablished...
1. end
   2.
   3. # Returns true if a connection that's accessible to this
   class has
   4. # already been opened.
   5. def connected?(klass)
   6. conn = retrieve_connection_pool(klass)
   7. conn  conn.connected?





 2014/1/15 arca0 arcaz...@gmail.com

 Hi Francois,
 it looks like your db configuration is somehow wrong. Care to submit
 more information about that? How does your db config look?
 alex

 From: Francois Sery sery.franc...@gmail.com
 Date: 15 January 2014 08:10
 Subject: camping app on elastic beanstalk
 To: camping-list@rubyforge.org



 Bonjour les Campers,
  i need help deploying a camping app on  AWS  with elastic beanstalk.
  i can run a simple hello camping app with do database and only one
 controller on elasticbeanstalk.But when i add  migration, model ,schema
 creation and update the  gemfile   it doesn't work anymore.
  the app works fine on my local machine but not on beanstalk .I dont
 understand  what is different from my local machine ?
 Its the first time I deploy  an app so every advices are welcome.
 here is the message from the log

 *** Exception ActiveRecord::ConnectionNotEstablished in Rack application 
 object (ActiveRecord::ConnectionNotEstablished)








 Thanks



 ___
 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



 ___
 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

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

Re: camping app on elastic beanstalk

2014-01-15 Thread arca0
Hi Francois,
it looks like your db configuration is somehow wrong. Care to submit more
information about that? How does your db config look?
alex

From: Francois Sery sery.franc...@gmail.com
 Date: 15 January 2014 08:10
 Subject: camping app on elastic beanstalk
 To: camping-list@rubyforge.org


 Bonjour les Campers,
 i need help deploying a camping app on  AWS  with elastic beanstalk.
  i can run a simple hello camping app with do database and only one
 controller on elasticbeanstalk.But when i add  migration, model ,schema
 creation and update the  gemfile   it doesn't work anymore.
  the app works fine on my local machine but not on beanstalk .I dont
 understand  what is different from my local machine ?
 Its the first time I deploy  an app so every advices are welcome.
 here is the message from the log

 *** Exception ActiveRecord::ConnectionNotEstablished in Rack application 
 object (ActiveRecord::ConnectionNotEstablished)



 Thanks



 ___
 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 app on elastic beanstalk

2014-01-14 Thread Francois Sery
Bonjour les Campers,
i need help deploying a camping app on  AWS  with elastic beanstalk.
 i can run a simple hello camping app with do database and only one
controller on elasticbeanstalk.But when i add  migration, model ,schema
creation and update the  gemfile   it doesn't work anymore.
 the app works fine on my local machine but not on beanstalk .I dont
understand  what is different from my local machine ?
Its the first time I deploy  an app so every advices are welcome.
here is the message from the log

*** Exception ActiveRecord::ConnectionNotEstablished in Rack
application object (ActiveRecord::ConnectionNotEstablished)

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

Deploy on amzn elastic beanstalk

2014-01-10 Thread Francois Sery
Hello campers
I  want to deploy a camping app on amazon elastic beanstalk. The example
from amazon use git and other specific tool but ther is anothet possility
to upload a zipped app. I ve tried with a .ru an .rb a and a gemfile that
worked fine on heroku but it doesnt work on amzn beanstalk. Im looking for
a tut or some valuable ressources on deploying camping or rack app on ebs .
Can anybody help me ? Thanks.
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: Multiple camping apps in the same rackup?

2014-01-01 Thread Magnus Holm
Yes:

map http://example.com; do
  run App
end

// Magnus Holm


On Wed, Jan 1, 2014 at 7:16 AM, Tim Uckun timuc...@gmail.com wrote:
 Can you match on top level domains?


 On Wed, Jan 1, 2014 at 1:05 AM, Magnus Holm judo...@gmail.com wrote:

 Sorry for the late reply.

 The easiest way is to use a config.ru file (this is how you probably
 run your Camping app anyway):

   # in config.ru
   map /hello do
 run Hello
   end

   map /sinatra do
 run Sinatra::Application.new
   end

 // Magnus Holm


 On Sun, Dec 8, 2013 at 12:41 PM, Tim Uckun timuc...@gmail.com wrote:
  The camping book says this
 
  You can also use Rack::URLMap to plug a whole bunch of different apps in
  to
  one folder. A camping app here, a rails project there, a sinatra doodad
  over
  there in the corner messing up the whole global namespace. The
  possibilities
  are severely limited!
 
  Does anybody have an example of how to do this?
 
  Thanks.
 
  ___
  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
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: how do i customize the 404 campin problem page?

2013-12-31 Thread Magnus Holm
Sorry for the late reply.

Here's how you override the 404:

module YourApp
  def r404(path)
My custom 404
  end
end

// Magnus Holm


On Tue, Dec 10, 2013 at 12:32 PM, Francois Sery sery.franc...@gmail.com wrote:
 Bonjour,
 one more newbie question: how do i customize the 404  campin problem page?
 i cant' find the answer anywhere else. i've read about the @status and
 @headers  but i don't kwow how to capture the error ? maybe a special
 route ?

 Thanks again for your help !

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


Re: how do i customize the 404 campin problem page?

2013-12-31 Thread Francois Sery
Thanks judofyr
Le 31 déc. 2013 16:03, Magnus Holm judo...@gmail.com a écrit :

 Sorry for the late reply.

 Here's how you override the 404:

 module YourApp
   def r404(path)
 My custom 404
   end
 end

 // Magnus Holm


 On Tue, Dec 10, 2013 at 12:32 PM, Francois Sery sery.franc...@gmail.com
 wrote:
  Bonjour,
  one more newbie question: how do i customize the 404  campin problem
 page?
  i cant' find the answer anywhere else. i've read about the @status and
  @headers  but i don't kwow how to capture the error ? maybe a special
  route ?
 
  Thanks again for your help !
 
  ___
  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

Re: Multiple camping apps in the same rackup?

2013-12-31 Thread Tim Uckun
Can you match on top level domains?


On Wed, Jan 1, 2014 at 1:05 AM, Magnus Holm judo...@gmail.com wrote:

 Sorry for the late reply.

 The easiest way is to use a config.ru file (this is how you probably
 run your Camping app anyway):

   # in config.ru
   map /hello do
 run Hello
   end

   map /sinatra do
 run Sinatra::Application.new
   end

 // Magnus Holm


 On Sun, Dec 8, 2013 at 12:41 PM, Tim Uckun timuc...@gmail.com wrote:
  The camping book says this
 
  You can also use Rack::URLMap to plug a whole bunch of different apps in
 to
  one folder. A camping app here, a rails project there, a sinatra doodad
 over
  there in the corner messing up the whole global namespace. The
 possibilities
  are severely limited!
 
  Does anybody have an example of how to do this?
 
  Thanks.
 
  ___
  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

Camping without markaby.

2013-12-22 Thread Tim Uckun
How can I use something other than markaby for my views? My understanding
is that markaby is very slow.

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

Re: Camping without markaby.

2013-12-22 Thread Magnus Holm
This should work:

Camping.goes :Xmas

module Xmas::Controllers
  class Index
def get
  render :index
end
  end
end

__END__

@@ index.erb
Hello %= 'world' %

// Magnus Holm


On Sun, Dec 22, 2013 at 10:26 PM, Tim Uckun timuc...@gmail.com wrote:
 How can I use something other than markaby for my views? My understanding is
 that markaby is very slow.

 Thanks.

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


Re: how to handle 4K session in camping

2013-12-10 Thread Francois Sery
Bonjour,
Thanks for your help. Here is how i've modified my app.
now i have
 - a 'session' model
- a  sessions table with a column for my data...
- a session cookie: @state[:sessionid]=SecureRandom.hex
It works as wanted but i have one more question.

how do you handle all the obsolete sessions in the database ?  my code
already delete some sessions. but  some  other sessions can't be deleted
from the flow of my app.  What are the available solutions?  cron ? or
something else maybe?

Merci.




2013/12/7 Bluebie a...@creativepony.com

  If you fill the session cookie with 4kb of data, that means every http
 request after that to that domain will require the user to upload 4kb of
 data, which may not seem like much, but on a mobile phone for instance,
 loading a page with 50 images, that becomes 4*50 = 200kb - pretty
 significant considering most home internet connections do not have very
 fast upload in many countries. On my own internet on a good day that’s at
 least 2 seconds of uploading.

 So it is best to use session cookies only to store a very small
 identifier, then store more information in a local database or file. If you
 have a look in the rack project you’ll see some other session handlers
 which do exactly this, so you can keep writing data in to the ‘session’ but
 have it stored locally, with only a small cookie with an ID number to
 lookup the local data stored in to the browser.

 —
 Bluebie

 On Saturday, 7 December 2013 at 8:27 am, Charles McKnight wrote:

 Sure wish the W3C would devise a better state mechanism than cookies...

 On Dec 6, 2013, at 12:49 PM, Magnus Holm judo...@gmail.com wrote:

 You should not store a large amount of data in the session. The
 session is stored in a cookie, and everything you store there has to
 be sent back and forth over the network. You can however store an ID
 in the session and lookup data in your database.

 // Magnus Holm


 On Tue, Dec 3, 2013 at 12:04 PM, Francois Sery sery.franc...@gmail.com
 wrote:

 hi , i need some advices.
 I a little Camping app i have to store a cart in a session . i tried
 achieving it using the default camping/session but it is limited to 4K and
 my card miss some data.
 how can store more than 4k in a session ? thanks.

 ___
 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


 The game's afoot. Follow your spirit, and upon this charge, cry God for
 Harry, England, and St. George. --- Sherlock Holmes

 ___
 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

2 differents layout for my app

2013-12-10 Thread Francois Sery
(re)bonjour,
is there a simple / elegant way to have 2 differents layouts for my app.
All the solutions i think of  seems unmanageable  and not very smart.

(re)merci
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: 2 differents layout for my app

2013-12-10 Thread deveritt
If the markup is semantic and nicely-structured, I'd simply do a CSS
switch that uses local storage to persist between visits, as I've done
here for the colour theme (http://ee.ecoconsulting.co.uk/ switch, top
right) but expanded to div widths, etc. Is that what you meant? -
DaveE
-
Email sent using Kcom WebMail - Email, Groupware and Calendaring done
right.
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: how to handle 4K session in camping

2013-12-10 Thread låzaro
Sorry for the thread hacking but, how could be run camping as standalone CGI
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Bluebie a...@creativepony.com escribió:
Unless you’re running your camping app as a CGI script, the ruby
instance keeps running, so you could just create a looping thread to do
it every now and then:  

hours = 2 # cleanup every two hours
Thread.new do
  loop do
# some database cleanup stuff
sleep hours * 60 * 60
  end
end

The only trouble with that is you’d have it happening multiple times if
you run multiple ruby servers behind a proxy like nginx, which is a
pretty common configuration. Probably cron is the best way to go if you
can easily do that. Otherwise you could attach it to some other event -
like you could spawn a thread whenever a user logs in, which cleans up
the sessions. If you wanted it to happen less frequently you could use
rand() to generate a random number, then, say, cleanup if rand  0.01
if you only wanted to cleanup sessions every 1 out of 100 times someone
logs in, roughly. That’s a stratergy people use a lot with systems like
PHP where cron can be difficult to setup and access.

I wouldn’t worry about it too much though. Your sessions will probably
still be quite small (only a couple dozen kilobytes, right?) so you can
probably just let them build up and then every six months or year or so
go and delete all the database records that are more than a week old in
that table. Storage is so cheap these days!  

—
Bluebie


On Tuesday, 10 December 2013 at 9:29 pm, Francois Sery wrote:

 Bonjour,
 Thanks for your help. Here is how i've modified my app.
 now i have
  - a 'session' model  
 - a  sessions table with a column for my data...
 - a session cookie: @state[:sessionid]=SecureRandom.hex
 It works as wanted but i have one more question.
  
 how do you handle all the obsolete sessions in the database ?  my
code already delete some sessions. but  some  other sessions can't be
deleted from the flow of my app.  What are the available solutions? 
cron ? or something else maybe?
  
 Merci.
  
  
  
  
 2013/12/7 Bluebie a...@creativepony.com (mailto:a...@creativepony.com)
  If you fill the session cookie with 4kb of data, that means every
http request after that to that domain will require the user to upload
4kb of data, which may not seem like much, but on a mobile phone for
instance, loading a page with 50 images, that becomes 4*50 = 200kb -
pretty significant considering most home internet connections do not
have very fast upload in many countries. On my own internet on a good
day that’s at least 2 seconds of uploading.  
   
  So it is best to use session cookies only to store a very small
identifier, then store more information in a local database or file. If
you have a look in the rack project you’ll see some other session
handlers which do exactly this, so you can keep writing data in to the
‘session’ but have it stored locally, with only a small cookie with an
ID number to lookup the local data stored in to the browser.  
   
  —
  Bluebie
   
   
  On Saturday, 7 December 2013 at 8:27 am, Charles McKnight wrote:
   
   Sure wish the W3C would devise a better state mechanism than
cookies...

   On Dec 6, 2013, at 12:49 PM, Magnus Holm judo...@gmail.com
(mailto:judo...@gmail.com) wrote:  

You should not store a large amount of data in the session. The
session is stored in a cookie, and everything you store there
has to
be sent back and forth over the network. You can however store
an ID
in the session and lookup data in your database.
 
// Magnus Holm
 
 
On Tue, Dec 3, 2013 at 12:04 PM, Francois Sery
sery.franc...@gmail.com (mailto:sery.franc...@gmail.com) wrote:
 hi , i need some advices.
 I a little Camping app i have to store a cart in a session .
i tried
 achieving it using the default camping/session but it is
limited to 4K and
 my card miss some data.
 how can store more than 4k in a session ? thanks.
  
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
(mailto:Camping-list@rubyforge.org)
 http://rubyforge.org/mailman/listinfo/camping-list
  
 
___
Camping-list mailing list
Camping-list@rubyforge.org (mailto:Camping-list@rubyforge.org)
http://rubyforge.org/mailman/listinfo/camping-list
 


   The game's afoot. Follow your spirit, and upon this charge, cry
God for Harry, England, and St. George. --- Sherlock Holmes

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



   
   
   
  ___
  Camping-list mailing list
  Camping-list@rubyforge.org (mailto:Camping-list@rubyforge.org)
  

Re: 2 differents layout for my app

2013-12-10 Thread Francois Sery
@deveritt: i dont want to switch css. My app has a front end and an
admin .
The front end is the public face of my app and th e'admin' is where i
manage the content. the visual design of these 2 part are very different
and it would be nice to have 2 independant  layout   . maybe, i don't even
know if it is possible , i could run 2 distinct app sharing the same
database or something like that. what do you think ?


2013/12/10 dever...@innotts.co.uk

 If the markup is semantic and nicely-structured, I'd simply do a CSS
 switch that uses local storage to persist between visits, as I've done here
 for the colour theme (http://ee.ecoconsulting.co.uk/ switch, top right)
 but expanded to div widths, etc. Is that what you meant? - DaveE
 --
 Email sent using Kcom WebMail - Email, Groupware and Calendaring done
 right.

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

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

Re: how to handle 4K session in camping

2013-12-10 Thread Magnus Holm
On Mon, Nov 4, 2013 at 8:55 PM, låzaro ad...@lex-sa.cu wrote:
 Sorry for the thread hacking but, how could be run camping as standalone CGI
 --
 Sent from my Android phone with K-9 Mail. Please excuse my brevity.

You can use Rack:

app.cgi:

  #!/usr/bin/env ruby
  require 'rack'
  require 'my_app'
  Rack::Server::CGI.run(MyApp)
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Multiple camping apps in the same rackup?

2013-12-08 Thread Tim Uckun
The camping book says this

You can also use Rack::URLMap to plug a whole bunch of different apps in to
one folder. A camping app here, a rails project there, a sinatra doodad
over there in the corner messing up the whole global namespace. The
possibilities are severely limited!

Does anybody have an example of how to do this?

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

Re: how to handle 4K session in camping

2013-12-06 Thread Magnus Holm
You should not store a large amount of data in the session. The
session is stored in a cookie, and everything you store there has to
be sent back and forth over the network. You can however store an ID
in the session and lookup data in your database.

// Magnus Holm


On Tue, Dec 3, 2013 at 12:04 PM, Francois Sery sery.franc...@gmail.com wrote:
 hi , i need some advices.
 I a little Camping app i have to store a cart in a session . i tried
 achieving it using the default camping/session but it is limited to 4K and
 my card miss some data.
  how can store more than 4k in a session ? thanks.

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


Re: how to handle 4K session in camping

2013-12-06 Thread Charles McKnight
Sure wish the W3C would devise a better state mechanism than cookies...

On Dec 6, 2013, at 12:49 PM, Magnus Holm judo...@gmail.com wrote:

 You should not store a large amount of data in the session. The
 session is stored in a cookie, and everything you store there has to
 be sent back and forth over the network. You can however store an ID
 in the session and lookup data in your database.
 
 // Magnus Holm
 
 
 On Tue, Dec 3, 2013 at 12:04 PM, Francois Sery sery.franc...@gmail.com 
 wrote:
 hi , i need some advices.
 I a little Camping app i have to store a cart in a session . i tried
 achieving it using the default camping/session but it is limited to 4K and
 my card miss some data.
 how can store more than 4k in a session ? thanks.
 
 ___
 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

The game's afoot. Follow your spirit, and upon this charge, cry God for Harry, 
England, and St. George. --- Sherlock Holmes

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


Re: how to handle 4K session in camping

2013-12-06 Thread Bluebie
If you fill the session cookie with 4kb of data, that means every http request 
after that to that domain will require the user to upload 4kb of data, which 
may not seem like much, but on a mobile phone for instance, loading a page with 
50 images, that becomes 4*50 = 200kb - pretty significant considering most home 
internet connections do not have very fast upload in many countries. On my own 
internet on a good day that’s at least 2 seconds of uploading.  

So it is best to use session cookies only to store a very small identifier, 
then store more information in a local database or file. If you have a look in 
the rack project you’ll see some other session handlers which do exactly this, 
so you can keep writing data in to the ‘session’ but have it stored locally, 
with only a small cookie with an ID number to lookup the local data stored in 
to the browser.  

—
Bluebie


On Saturday, 7 December 2013 at 8:27 am, Charles McKnight wrote:

 Sure wish the W3C would devise a better state mechanism than cookies...
  
 On Dec 6, 2013, at 12:49 PM, Magnus Holm judo...@gmail.com 
 (mailto:judo...@gmail.com) wrote:
  
  You should not store a large amount of data in the session. The
  session is stored in a cookie, and everything you store there has to
  be sent back and forth over the network. You can however store an ID
  in the session and lookup data in your database.
   
  // Magnus Holm
   
   
  On Tue, Dec 3, 2013 at 12:04 PM, Francois Sery sery.franc...@gmail.com 
  (mailto:sery.franc...@gmail.com) wrote:
   hi , i need some advices.
   I a little Camping app i have to store a cart in a session . i tried
   achieving it using the default camping/session but it is limited to 4K and
   my card miss some data.
   how can store more than 4k in a session ? thanks.

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

   
  ___
  Camping-list mailing list
  Camping-list@rubyforge.org (mailto:Camping-list@rubyforge.org)
  http://rubyforge.org/mailman/listinfo/camping-list
   
  
  
 The game's afoot. Follow your spirit, and upon this charge, cry God for 
 Harry, England, and St. George. --- Sherlock Holmes
  
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org (mailto: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

how to handle 4K session in camping

2013-12-03 Thread Francois Sery
hi , i need some advices.
I a little Camping app i have to store a cart in a session . i tried
achieving it using the default camping/session but it is limited to 4K and
my card miss some data.
 how can store more than 4k in a session ? thanks.
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: how to handle 4K session in camping

2013-12-03 Thread Michael McMillan
Hi Francis!

4K is not a limit set by Camping, as far as I know. 4K is a limit most
modern browsers enforce.


On Tue, Dec 3, 2013 at 12:04 PM, Francois Sery sery.franc...@gmail.comwrote:

 hi , i need some advices.
 I a little Camping app i have to store a cart in a session . i tried
 achieving it using the default camping/session but it is limited to 4K and
 my card miss some data.
  how can store more than 4k in a session ? thanks.

 ___
 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

Benchmarked

2013-11-18 Thread Koaps Freeman
Hi guys,

I wanted to share my latest little project with you.

While it's not totally camping specific, it does use camping as it's main
test bed.

http://nullworks.wordpress.com/2013/11/17/benchmarked/

https://github.com/koaps/benmark


Basically it's my attempt at seeing what ruby server does a decent job on
JRuby as a camping server.

Take a look and feel free to let me know of any improvements that can be
done.

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

Re: Benchmarked

2013-11-18 Thread Tim Uckun
ASW would be interesting as that's a very common use case for us and I am
sure many other people.


On Tue, Nov 19, 2013 at 12:44 PM, Koaps Freeman koapsfree...@gmail.comwrote:

 I was initially playing with Erlang, talk about good times, and I just got
 frustrated trying to do things I can do easily in Ruby and decided to fall
 back to Camping which I like a lot.

 Then I came across Celluloid (http://celluloid.io/) and with it on JRuby
 you can pretty much take full advantage of all your CPU cores.

 Plus it does the 'let it fail' actor model, so when your Camping app
 crashes, it just restarts the actor again.

 This can make for a really robust webapp with all the benefits of running
 within a JVM.

 I then saw Reel-Rack which made running Camping easier, but I had the
 question of, how good would the performance be with all the overhead of JVM
 - JRuby - Celluloid::IO - Reel - Reel-Rack - Camping.

 That's when I started putting together the benchmark project just to see
 how that setup would look against a MRI version of my webapps.

 The simple tests don't really do it much justice, I'm starting to play
 with DCell and ZeroMQ, so I might try to come up with some examples where
 JRuby can use all the cores and see how MRI does with the same code.

 I also tried to play with Rubinis but ran into install issues with some
 Gems so I decided to stick with JRuby.

 I'm also on SmartOS in a Zone and KVM for Linux, so the tests might be
 completely different on a pure linux install on the same hardware, for
 better or worse.

 Would be interesting to see but I'm not going to rebuild my server to find
 out, maybe I'll try it in AWS or something.


 On Mon, Nov 18, 2013 at 2:53 PM, Tim Uckun timuc...@gmail.com wrote:


 Those are fascinating and very surprising results.

 I thought for sure trinidad would rule over all of them.  The performance
 of Puma is also very surprising.

 So do you think there is any reason to use jruby at all given your
 benchmarks. MRI seems to be pretty good.

 ___
 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

Camping Blog with Sequel, Thin and Rake

2013-11-14 Thread Koaps Freeman
Hi All,

I just wanted to pass along some code I did recently.

https://github.com/koaps/camping-thin-blog

It's basically the Camping example Blog modified to work with Sequel, Thin
Server and Rake migrations.

I mainly did this because I'm testing using Camping on JRuby and
Celluloid's Reel-Rack and since native extensions are problematic on
current JRuby, I needed an easy alternative to pg gem and Sequel
JDBC:Postgres isn't bad, though I could have used JDBC from AR.


As a side note, here's my Nginx/HAProxy setup I'm using to frontend the
Camping Apps with a backup server to host a static page if the app is down.

http://nullworks.wordpress.com/2013/11/09/nginx-and-haproxy-for-fun-and-profit/
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: Camping Blog with Sequel, Thin and Rake

2013-11-14 Thread låzaro
amazing job

Thread name: Camping Blog with Sequel, Thin and Rake 
Mail number: 1 
Date: Thu, Nov 14, 2013 
In reply to: Koaps Freeman 

 Hi All,
 
 I just wanted to pass along some code I did recently.
 
 https://github.com/koaps/camping-thin-blog
 
 It's basically the Camping example Blog modified to work with Sequel, Thin
 Server and Rake migrations.
 
 I mainly did this because I'm testing using Camping on JRuby and Celluloid's
 Reel-Rack and since native extensions are problematic on current JRuby, I
 needed an easy alternative to pg gem and Sequel JDBC:Postgres isn't bad, 
 though
 I could have used JDBC from AR.
 
 
 As a side note, here's my Nginx/HAProxy setup I'm using to frontend the 
 Camping
 Apps with a backup server to host a static page if the app is down.
 
 http://nullworks.wordpress.com/2013/11/09/nginx-and-haproxy-for-fun-and-profit/
 

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


-- 
 Warning! 
100'000 pelos de escoba fueron
introducidos satisfactoriamente
en su puerto USB.




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


Re: Camping Blog with Sequel, Thin and Rake

2013-11-14 Thread Tim Uckun
Thanks for posting this. It's good to have a non trivial one file app to
learn from.




On Fri, Nov 15, 2013 at 7:31 AM, Koaps Freeman koapsfree...@gmail.comwrote:

 Hi All,

 I just wanted to pass along some code I did recently.

 https://github.com/koaps/camping-thin-blog

 It's basically the Camping example Blog modified to work with Sequel, Thin
 Server and Rake migrations.

 I mainly did this because I'm testing using Camping on JRuby and
 Celluloid's Reel-Rack and since native extensions are problematic on
 current JRuby, I needed an easy alternative to pg gem and Sequel
 JDBC:Postgres isn't bad, though I could have used JDBC from AR.


 As a side note, here's my Nginx/HAProxy setup I'm using to frontend the
 Camping Apps with a backup server to host a static page if the app is down.


 http://nullworks.wordpress.com/2013/11/09/nginx-and-haproxy-for-fun-and-profit/


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

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

Re: Would like some hints on best ways to search for camping questions.

2013-11-10 Thread Dave Everitt

Hi Tim

I maintain (periodically) a little Camping app with the links I've  
collected over the years. They may be helpful:

  http://ruby-camping-links.1.ai/

Also, the maling ist archive on RubyForge is searchable:
  http://www.mail-archive.com/camping-list@rubyforge.org/

DaveE


Thanks.

I might try the IRC but I am in NZ (currently in AU) so my time  
zones tend to be unfriendly to most IRC channels.


My questions are about non trivial apps.  What do I do about  
migrations? What if I don't want to use markaby? what's a good  
strateg for breaking your app up into different files?.





On Sat, Nov 2, 2013 at 1:42 AM, låzaro netad...@lex-sa.cu wrote:
jusr now we hace a big problem with doc, but here in the mailing  
list you
will have all you answers. Also in the IRC channel #camping we could  
help
you. I'm  writing new doc about camping and need questions like  
yours, son

write me please, and I'll focus the doc via your questions.



Thread name: Would like some hints on best ways to search for  
camping questions.

Mail number: 1
Date: Fri, Nov 01, 2013
In reply to: Tim Uckun

 Hello Campers.

 On a whim I thought I would try to fool around with camping.   The
 documentation is nice and does a fine job of covering what it  
wants to cover
 but I needed some information not covered by the docs so I tried  
various ways
 to search google for them. For some reason the searching ended up  
being a bit
 frustrating. I guess the words ruby and camping are too common.
Unfortunately

 the mailing list archives are not searchable either.

 So how do you craft your searches?  In my case I was looking for  
information on
 how to handle migrations and how to use different views (not  
markaby).


 Cheers.

 ___


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

Re: Would like some hints on best ways to search for camping questions.

2013-11-04 Thread låzaro
exactly whay do you wanna do with migrations?





Thread name: Re: Would like some hints on best ways to search for camping 
questions. 
Mail number: 1 
Date: Mon, Nov 04, 2013 
In reply to: Tim Uckun 

 Thanks. 
 
 I might try the IRC but I am in NZ (currently in AU) so my time zones tend to
 be unfriendly to most IRC channels.
 
 My questions are about non trivial apps.  What do I do about migrations? What
 if I don't want to use markaby? what's a good strateg for breaking your app up
 into different files?.
 
 
 
 
 On Sat, Nov 2, 2013 at 1:42 AM, låzaro netad...@lex-sa.cu wrote:
 
 jusr now we hace a big problem with doc, but here in the mailing list you
 will have all you answers. Also in the IRC channel #camping we could help
 you. I'm  writing new doc about camping and need questions like yours, son
 write me please, and I'll focus the doc via your questions.
 
 
 
 Thread name: Would like some hints on best ways to search for camping
 questions.
 Mail number: 1
 Date: Fri, Nov 01, 2013
 In reply to: Tim Uckun
 
  Hello Campers.
 
  On a whim I thought I would try to fool around with camping.   The
  documentation is nice and does a fine job of covering what it wants to
 cover
  but I needed some information not covered by the docs so I tried various
 ways
  to search google for them. For some reason the searching ended up being 
 a
 bit
  frustrating. I guess the words ruby and camping are too common.  
 Unfortunately
  the mailing list archives are not searchable either.
 
  So how do you craft your searches?  In my case I was looking for
 information on
  how to handle migrations and how to use different views (not markaby).
 
  Cheers.
 
  ___
  Camping-list mailing list
  Camping-list@rubyforge.org
  http://rubyforge.org/mailman/listinfo/camping-list
 
 
 --
  Warning! 
 100'000 pelos de escoba fueron
 introducidos satisfactoriamente
 en su puerto USB.
 
 
 
 
 ___
 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


-- 
 Warning! 
100'000 pelos de escoba fueron
introducidos satisfactoriamente
en su puerto USB.




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

Re: Would like some hints on best ways to search for camping questions.

2013-11-03 Thread Tim Uckun
Thanks.

I might try the IRC but I am in NZ (currently in AU) so my time zones tend
to be unfriendly to most IRC channels.

My questions are about non trivial apps.  What do I do about migrations?
What if I don't want to use markaby? what's a good strateg for breaking
your app up into different files?.




On Sat, Nov 2, 2013 at 1:42 AM, låzaro netad...@lex-sa.cu wrote:

 jusr now we hace a big problem with doc, but here in the mailing list you
 will have all you answers. Also in the IRC channel #camping we could help
 you. I'm  writing new doc about camping and need questions like yours, son
 write me please, and I'll focus the doc via your questions.



 Thread name: Would like some hints on best ways to search for camping
 questions.
 Mail number: 1
 Date: Fri, Nov 01, 2013
 In reply to: Tim Uckun
 
  Hello Campers.
 
  On a whim I thought I would try to fool around with camping.   The
  documentation is nice and does a fine job of covering what it wants to
 cover
  but I needed some information not covered by the docs so I tried various
 ways
  to search google for them. For some reason the searching ended up being
 a bit
  frustrating. I guess the words ruby and camping are too common.
 Unfortunately
  the mailing list archives are not searchable either.
 
  So how do you craft your searches?  In my case I was looking for
 information on
  how to handle migrations and how to use different views (not markaby).
 
  Cheers.

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


 --
  Warning! 
 100'000 pelos de escoba fueron
 introducidos satisfactoriamente
 en su puerto USB.




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

Re: Would like some hints on best ways to search for camping questions.

2013-11-01 Thread låzaro
jusr now we hace a big problem with doc, but here in the mailing list you
will have all you answers. Also in the IRC channel #camping we could help
you. I'm  writing new doc about camping and need questions like yours, son
write me please, and I'll focus the doc via your questions.



Thread name: Would like some hints on best ways to search for camping 
questions. 
Mail number: 1 
Date: Fri, Nov 01, 2013 
In reply to: Tim Uckun 

 Hello Campers.
 
 On a whim I thought I would try to fool around with camping.   The
 documentation is nice and does a fine job of covering what it wants to cover
 but I needed some information not covered by the docs so I tried various ways
 to search google for them. For some reason the searching ended up being a bit
 frustrating. I guess the words ruby and camping are too common.   
 Unfortunately
 the mailing list archives are not searchable either.
 
 So how do you craft your searches?  In my case I was looking for information 
 on
 how to handle migrations and how to use different views (not markaby).
 
 Cheers.

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


-- 
 Warning! 
100'000 pelos de escoba fueron
introducidos satisfactoriamente
en su puerto USB.




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

Would like some hints on best ways to search for camping questions.

2013-10-31 Thread Tim Uckun
Hello Campers.

On a whim I thought I would try to fool around with camping.   The
documentation is nice and does a fine job of covering what it wants to
cover but I needed some information not covered by the docs so I tried
various ways to search google for them. For some reason the searching ended
up being a bit frustrating. I guess the words ruby and camping are too
common.   Unfortunately the mailing list archives are not searchable either.

So how do you craft your searches?  In my case I was looking for
information on how to handle migrations and how to use different views (not
markaby).

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

Re: Omniauth and rack middleware

2013-10-24 Thread Magnus Holm
Hi Francois,

Just use `MyApp.use`:

Camping.goes :Nuts

module Nuts
  use OmniAuth::Builder do
provider :facebook, 'FACEBOOK_ID', 'FACEBOOK_SECRET'
  end
end


// Magnus Holm


On Tue, Oct 22, 2013 at 9:11 AM, Francois Sery sery.franc...@gmail.comwrote:

 Bonjour
 I m new to rack middleware and i dont know how to use with camping. My end
 goal is to use omniauth with a little camping app. Could you help me with
 existing examples or anything else ? Merci.

 ___
 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

Omniauth and rack middleware

2013-10-22 Thread Francois Sery
Bonjour
I m new to rack middleware and i dont know how to use with camping. My end
goal is to use omniauth with a little camping app. Could you help me with
existing examples or anything else ? Merci.
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: Problems with sqlite3 and JRuby

2013-08-12 Thread låzaro
I suggest you to use sequel instead AR. The AR's support is patethic just
rigth now, due the Rails's changes.

http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html


Thread name: Problems with sqlite3 and JRuby 
Mail number: 1 
Date: Sun, Aug 11, 2013 
In reply to: Thomas Seliger 

 Hello,
 
 I am new to camping and I really like the zen of this framework. I would
 like to use it with Jruby and followed the instructions at
 http://camping.io/Camping-in-jRuby
 
 But I am unsure, where I should put
 
   ActiveRecord::Base.establish_connection(
 :adapter = 'jdbcsqlite3',
 :database = foo.sqlite3
   )
 
 in the code.
 
 I am doing my experiments with the simple example from the camping book,
 but I always get:
 
   Gem::LoadError at /
   Specified 'sqlite3' for database adapter, but the gem is not loaded.
   Add `gem 'sqlite3'` to your Gemfile.
 
 No matter what I do, camping runs this part in lib/camping/server.rb
   
 if !Camping::Models.autoload?(:Base)  options[:database]
   Camping::Models::Base.establish_connection(...
 :adapter = 'sqlite3',
 :database = options[:database]
   )
 end
 
 Maybe you could point me into the right direction, I think that I am
 doing something wrong here.
 
 Thanks!
 Tom
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

-- 
 Warning! 
100'000 pelos de escoba fueron
introducidos satisfactoriamente
en su puerto USB.




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


Re: Problems with sqlite3 and JRuby

2013-08-12 Thread Thomas Seliger
I got further yesterday by patching camping so that it uses jdbcsqlite3.
But I encountered another problem, which was Jruby+activerecord related.

It worked with native ruby but with Jruby I always got:

  Nuts::Models is not missing constant Base!

  Ruby
/home/tom/.rbenv/versions/jruby-1.7.4/gemsets/ugcmanager/gems/activesupport-
  4.0.0/lib/active_support/dependencies.rb: in load_missing_constant,
line 448

I already thought about ditching AR for sequel, is there an easy (maybe
someone did it already) way to replace AR with sequel in camping? I
would like to retain the nice camping model features like db migration.

Anway thanks for the reply!
Tom


Am 12.08.2013 16:54, schrieb låzaro:
 I suggest you to use sequel instead AR. The AR's support is patethic just
 rigth now, due the Rails's changes.
 
 http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html
 
 

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


Re: Problems with sqlite3 and JRuby

2013-08-12 Thread låzaro
try:

module Nuts::Models

   # you JDB connection here
   DB=Sequel.connect fulanito_connection

   class Table  Sequel::Model(:table_name)
   end

end


Or use something AR related, it do not must raise any error. For example,
do not use the 

 V 1.2 schema...



As long you dont say Base in anywhere, campign will not, call their AR
weird DB backend core. and do ont include Moldes in the controller (do no
use include sentence inside the Controllers module)

Main developer say, that Models is an empty Module, as long you no call
Base in any place...



Thread name: Re: Problems with sqlite3 and JRuby 
Mail number: 1 
Date: Mon, Aug 12, 2013 
In reply to: Thomas Seliger 

 I got further yesterday by patching camping so that it uses jdbcsqlite3.
 But I encountered another problem, which was Jruby+activerecord related.
 
 It worked with native ruby but with Jruby I always got:
 
   Nuts::Models is not missing constant Base!
 
   Ruby
 /home/tom/.rbenv/versions/jruby-1.7.4/gemsets/ugcmanager/gems/activesupport-
   4.0.0/lib/active_support/dependencies.rb: in load_missing_constant,
 line 448
 
 I already thought about ditching AR for sequel, is there an easy (maybe
 someone did it already) way to replace AR with sequel in camping? I
 would like to retain the nice camping model features like db migration.
 
 Anway thanks for the reply!
 Tom
 
 
 Am 12.08.2013 16:54, schrieb låzaro:
  I suggest you to use sequel instead AR. The AR's support is patethic just
  rigth now, due the Rails's changes.
  
  http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html
  
  
 
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

-- 
 Warning! 
100'000 pelos de escoba fueron
introducidos satisfactoriamente
en su puerto USB.




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


Problems with sqlite3 and JRuby

2013-08-11 Thread Thomas Seliger
Hello,

I am new to camping and I really like the zen of this framework. I would
like to use it with Jruby and followed the instructions at
http://camping.io/Camping-in-jRuby

But I am unsure, where I should put

  ActiveRecord::Base.establish_connection(
:adapter = 'jdbcsqlite3',
:database = foo.sqlite3
  )

in the code.

I am doing my experiments with the simple example from the camping book,
but I always get:

  Gem::LoadError at /
  Specified 'sqlite3' for database adapter, but the gem is not loaded.
  Add `gem 'sqlite3'` to your Gemfile.

No matter what I do, camping runs this part in lib/camping/server.rb

if !Camping::Models.autoload?(:Base)  options[:database]
  Camping::Models::Base.establish_connection(...
:adapter = 'sqlite3',
:database = options[:database]
  )
end

Maybe you could point me into the right direction, I think that I am
doing something wrong here.

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


'Ruby Camping links' now live again

2013-08-08 Thread Dave Everitt

Good morning Campers!

My little Camping app with all the Camping links I collected over the  
years is now updated and live again at:

  http://ruby-camping-links.1.ai/

This is my own handy collection so not a definitive list, but if  
anyone wants to submit additions/changes they can either email me, or  
send a pull request:

  https://github.com/DaveEveritt/Camping-links

Thanks to David's continuing generosity at dotgeek.org

- DaveE

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


More crap from AR 4

2013-07-08 Thread låzaro
Hi, all, now with AR-4 is imposible to add any relation

I mean for example:

Blog.entries.new 

And you'll have a very weird erro. Do not happen the same thing when you do
it in the console.

NO ONE application, work the Table.relation.new or Table.relation.create...

except in the console...

Could we move to datamapper???



ArgumentError at /estacion/pacientes/evolucionar/1

wrong number of arguments (1 for 2)

Ruby main: in initialize, line 27
Web  POST localhost/estacion/pacientes/evolucionar/1

Jump to:

  * GET
  * POST
  * Cookies
  * ENV

Traceback (innermost first)

  * main: in initialize
  * 
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/inheritance.rb:
 in new
20. end
21. if (attrs = args.first).is_a?(Hash)
22. if subclass = subclass_from_attrs(attrs)
23. return subclass.new(*args, block)
24. end
25. end
26. # Delegate to the original .new
27. super...
28. end
29.
30. # True if this isn't a concrete subclass needing a STI type condition.
31. def descends_from_active_record?
32. if self == Base
33. false
34. elsif superclass.abstract_class?
  * 
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/inheritance.rb:
 in new
20. end
21. if (attrs = args.first).is_a?(Hash)
22. if subclass = subclass_from_attrs(attrs)
23. return subclass.new(*args, block)
24. end
25. end
26. # Delegate to the original .new
27. super...
28. end
29.
30. # True if this isn't a concrete subclass needing a STI type condition.
31. def descends_from_active_record?
32. if self == Base
33. false
34. elsif superclass.abstract_class?
  * 
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/reflection.rb:
 in build_association
182. super
183. @collection = [:has_many, :has_and_belongs_to_many].include?(macro)
184. end
185.
186. # Returns a new, unsaved instance of the associated class. 
+attributes+ will
187. # be passed to the class's constructor.
188. def build_association(attributes, block)
189. klass.new(attributes, block)...
190. end
191.
192. def table_name
193. @table_name ||= klass.table_name
194. end
195.
196. def quoted_table_name
  * 
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/associations/association.rb:
 in build_record
235. # the target is stale.
236. #
237. # This is only relevant to certain associations, which is why it 
returns nil by default.
238. def stale_state
239. end
240.
241. def build_record(attributes)
242. reflection.build_association(attributes) do |record|...
243. initialize_attributes(record)
244. end
245. end
246. end
247. end
248. end
  * 
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/associations/collection_association.rb:
 in build
107. first_or_last(:last, *args)
108. end
109.
110. def build(attributes = {}, block)
111. if attributes.is_a?(Array)
112. attributes.collect { |attr| build(attr, block) }
113. else
114. add_to_target(build_record(attributes)) do |record|...
115. yield(record) if block_given?
116. end
117. end
118. end
119.
120. def create(attributes = {}, block)
121. create_record(attributes, block)
  * 
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/associations/collection_proxy.rb:
 in build
222. # # #Pet id: nil, name: Choo-Choo, person_id: 1,
223. # # #Pet id: nil, name: Brain, person_id: 1
224. # # ]
225. #
226. # person.pets.size # = 5 # size of the collection
227. # person.pets.count # = 0 # count from database
228. def build(attributes = {}, block)
229. @association.build(attributes, block)...
230. end
231. alias_method :new, :build
232.
233. # Returns a new object of the collection type that has been 
instantiated with
234. # attributes, linked to this object and that has already been saved 
(if it
235. # passes the validations).
236. #
  * hermes.rb: in post
1098. # el paciente viene del parametro dado
1099. @paciente=Paciente.find_by_cama paciente
1100.
1101. # validamos que este listo para evolucionar
1102. @fiebre=input.include? 'fiebre'
1103.
1104. # creamos el paciente nuevo
1105. @evolucion=@paciente.evoluciones.new 
:evolucion=input.evolucion.to_s, :fiebre=@fiebre,:senho=@state[:realname]...
1106.
1107. @evolucion.save # muestrame como quedo
1108. redirect R(EstacionPacientesN,paciente)
1109.
1110. end # if
.
1112. end # post
  * main: in block in service
  * main: in catch
  * main: in service
  * main: in call
  * 
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/session/abstract/id.rb: 
in call
218.
219. def call(env)
220. context(env)
221. end
222.
223. def context(env, 

Re: More crap from AR 4

2013-07-08 Thread låzaro
We could use squel, it is very sloid and AR like interface

http://sequel.rubyforge.org/rdoc/files/doc/active_record_rdoc.html


Thread name: More crap from AR 4 
Mail number: 1 
Date: Sat, Jul 06, 2013 
In reply to: låzaro 

 Hi, all, now with AR-4 is imposible to add any relation
 
 I mean for example:
 
 Blog.entries.new 
 
 And you'll have a very weird erro. Do not happen the same thing when you do
 it in the console.
 
 NO ONE application, work the Table.relation.new or Table.relation.create...
 
 except in the console...
 
 Could we move to datamapper???
 
 
 
 ArgumentError at /estacion/pacientes/evolucionar/1
 
 wrong number of arguments (1 for 2)
 
 Ruby main: in initialize, line 27
 Web  POST localhost/estacion/pacientes/evolucionar/1
 
 Jump to:
 
   * GET
   * POST
   * Cookies
   * ENV
 
 Traceback (innermost first)
 
   * main: in initialize
   * 
 /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/inheritance.rb:
  in new
 20. end
 21. if (attrs = args.first).is_a?(Hash)
 22. if subclass = subclass_from_attrs(attrs)
 23. return subclass.new(*args, block)
 24. end
 25. end
 26. # Delegate to the original .new
 27. super...
 28. end
 29.
 30. # True if this isn't a concrete subclass needing a STI type condition.
 31. def descends_from_active_record?
 32. if self == Base
 33. false
 34. elsif superclass.abstract_class?
   * 
 /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/inheritance.rb:
  in new
 20. end
 21. if (attrs = args.first).is_a?(Hash)
 22. if subclass = subclass_from_attrs(attrs)
 23. return subclass.new(*args, block)
 24. end
 25. end
 26. # Delegate to the original .new
 27. super...
 28. end
 29.
 30. # True if this isn't a concrete subclass needing a STI type condition.
 31. def descends_from_active_record?
 32. if self == Base
 33. false
 34. elsif superclass.abstract_class?
   * 
 /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/reflection.rb:
  in build_association
 182. super
 183. @collection = [:has_many, :has_and_belongs_to_many].include?(macro)
 184. end
 185.
 186. # Returns a new, unsaved instance of the associated class. 
 +attributes+ will
 187. # be passed to the class's constructor.
 188. def build_association(attributes, block)
 189. klass.new(attributes, block)...
 190. end
 191.
 192. def table_name
 193. @table_name ||= klass.table_name
 194. end
 195.
 196. def quoted_table_name
   * 
 /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/associations/association.rb:
  in build_record
 235. # the target is stale.
 236. #
 237. # This is only relevant to certain associations, which is why it 
 returns nil by default.
 238. def stale_state
 239. end
 240.
 241. def build_record(attributes)
 242. reflection.build_association(attributes) do |record|...
 243. initialize_attributes(record)
 244. end
 245. end
 246. end
 247. end
 248. end
   * 
 /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/associations/collection_association.rb:
  in build
 107. first_or_last(:last, *args)
 108. end
 109.
 110. def build(attributes = {}, block)
 111. if attributes.is_a?(Array)
 112. attributes.collect { |attr| build(attr, block) }
 113. else
 114. add_to_target(build_record(attributes)) do |record|...
 115. yield(record) if block_given?
 116. end
 117. end
 118. end
 119.
 120. def create(attributes = {}, block)
 121. create_record(attributes, block)
   * 
 /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/associations/collection_proxy.rb:
  in build
 222. # # #Pet id: nil, name: Choo-Choo, person_id: 1,
 223. # # #Pet id: nil, name: Brain, person_id: 1
 224. # # ]
 225. #
 226. # person.pets.size # = 5 # size of the collection
 227. # person.pets.count # = 0 # count from database
 228. def build(attributes = {}, block)
 229. @association.build(attributes, block)...
 230. end
 231. alias_method :new, :build
 232.
 233. # Returns a new object of the collection type that has been 
 instantiated with
 234. # attributes, linked to this object and that has already been saved 
 (if it
 235. # passes the validations).
 236. #
   * hermes.rb: in post
 1098. # el paciente viene del parametro dado
 1099. @paciente=Paciente.find_by_cama paciente
 1100.
 1101. # validamos que este listo para evolucionar
 1102. @fiebre=input.include? 'fiebre'
 1103.
 1104. # creamos el paciente nuevo
 1105. @evolucion=@paciente.evoluciones.new 
 :evolucion=input.evolucion.to_s, 
 :fiebre=@fiebre,:senho=@state[:realname]...
 1106.
 1107. @evolucion.save # muestrame como quedo
 

Re: More crap from AR 4

2013-07-08 Thread Julik Tarkhanov
Maybe Camping should stick to AR3 then? at least until these are resolved?

On 7 jul. 2013, at 03:24, låzaro netad...@lex-sa.cu wrote:

 Hi, all, now with AR-4 is imposible to add any relation


--
Julik Tarkhanov
m...@julik.nl



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

Re: More crap from AR 4

2013-07-08 Thread David C gurugeek
+1 for this. I suggest that we do not do anything to break bw compatibility. I 
am using camping in production and I would certainly not like to see all the 
code breaking at the next camping update... thanks
David

On Jul 8, 2013, at 5:44 PM, Julik Tarkhanov julian.tarkha...@gmail.com wrote:

 Maybe Camping should stick to AR3 then? at least until these are resolved?
 
 On 7 jul. 2013, at 03:24, låzaro netad...@lex-sa.cu wrote:
 
 Hi, all, now with AR-4 is imposible to add any relation
 
 
 --
 Julik Tarkhanov
 m...@julik.nl
 
 
 
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list

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

Re: More crap from AR 4

2013-07-08 Thread låzaro
the github version break everything. Just now, the old warning this:

DEPRECATION WARNING: Database connections will not be closed automatically,
please close your database connection at the end of the thread by calling
`close` on your connection.  For example:
ActiveRecord::Base.connection.close

Do not allow work with AR-4, the databae just break the overflow after 4 o
5 request.

Options: Anchor in the version 3.x

A better option would be use Sequel, it have an very similar AR's like API




Thread name: Re: More crap from AR 4 
Mail number: 1 
Date: Mon, Jul 08, 2013 
In reply to: David C gurugeek 

 +1 for this. I suggest that we do not do anything to break bw compatibility. I
 am using camping in production and I would certainly not like to see all the
 code breaking at the next camping update... thanks
 David
 
 On Jul 8, 2013, at 5:44 PM, Julik Tarkhanov julian.tarkha...@gmail.com 
 wrote:
 
 
 Maybe Camping should stick to AR3 then? at least until these are resolved?
 
 On 7 jul. 2013, at 03:24, l zaro netad...@lex-sa.cu wrote:
 
 
 Hi, all, now with AR-4 is imposible to add any relation
 
 

 --
 Julik Tarkhanov
 m...@julik.nl
 

 
 ___
 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


-- 
 Warning! 
100'000 pelos de escoba fueron
introducidos satisfactoriamente
en su puerto USB.




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


ActiveRecord 4 posible bug

2013-07-02 Thread låzaro
hi, this look like a bug. Version ago I seen something about close database
connection but now, the connection fade. Just leave the page loaded 5
minutes or more and it become Timeout

ActiveRecord::ConnectionTimeoutError at /detalles
could not obtain a database connection within 5.000 seconds (waited 5.000 
seconds)
Ruby 
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/
connection_pool.rb: in block in wait_poll, line 190

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


Re: migrations

2013-07-02 Thread låzaro
yes,yes, I did something like that.. thanks master ;)


Thread name: Re: migrations 
Mail number: 1 
Date: Mon, Jul 01, 2013 
In reply to: Kenneth Pullen 

 Lazaro,
 
 I can't tell for sure what's going on without looking at your code, but I'm
 willing to bet you are defining the classes like so:
 
     class BasicFields  V 1.0
         # some stuff
     end
 
     class BasicFields  V 1.1
         # some other stuff
     end
 
 Am I right? If so, then you're not having a problem with Camping at all - it's
 a problem with Ruby. Well, not really a problem, but more like a side effect.
 The second definition of BasicFields is trying to redefine the superclass of a
 defined class, and I'm not sure you can, or even would want to do that. An 
 easy
 solution to this issue is to just use a different, descriptive name for your
 migration class. Something like:
 
     class BasicFields  V 1.0
     end
 
     class SomeFieldsMarketingSaidWeNeeded  V 1.1
     end
 
 
 See? You are defining a class, but really just treat that class name as a
 descriptor for the purpose of your migration. It's not going to be used
 anywhere - you aren't really ever going to manually instantiate the migration,
 and Camping knows what to do.
 
 If this isn't your problem, then I sincerely apologize for wasting your
 valuable time. Go get those little wheels!
 
 3 Ken
 
 
 On Fri, Jun 28, 2013 at 9:21 AM, Lázaro Armando netad...@lex-sa.cu wrote:
 
 Hi
 
 I'm trying to add a column in to my model, just write a BasicFields V 1.1
 in to my models but when running camping it return this error
 
 deisi.rb:722:in `module:Models': superclass mismatch for class
 BasicFields (TypeError)
         from deisi.rb:688:in `module:Deisi'
         from deisi.rb:15:in `top (required)'
         from /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1.532/lib/
 camping/reloader.rb:98:in `load'
         from /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1.532/lib/
 camping/reloader.rb:98:in `load_file'
         from /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1.532/lib/
 camping/reloader.rb:60:in `load_apps'
         from /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1.532/lib/
 camping/reloader.rb:124:in `reload!'
         from /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1.532/lib/
 camping/server.rb:134:in `start'
         from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/
 server.rb:141:in `start'
         from /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1.532/bin/
 camping:9:in `top (required)'
         from /usr/local/bin/camping:23:in `load'
         from /usr/local/bin/camping:23:in `main'
 
 
 That only happen if I have 1.0 and 1.1 declared, after delete 1.0 that
 error is banished
 
 My question:
 
 I must delete the old BasicFields class?
 
 ___
 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


-- 
 Warning! 
100'000 pelos de escoba fueron
introducidos satisfactoriamente
en su puerto USB.




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

Re: migrations

2013-07-01 Thread Kenneth Pullen
Lazaro,

I can't tell for sure what's going on without looking at your code, but I'm
willing to bet you are defining the classes like so:

class BasicFields  V 1.0
# some stuff
end

class BasicFields  V 1.1
# some other stuff
end

Am I right? If so, then you're not having a problem with Camping at all -
it's a problem with Ruby. Well, not really a problem, but more like a side
effect. The second definition of BasicFields is trying to redefine the
superclass of a defined class, and I'm not sure you can, or even would want
to do that. An easy solution to this issue is to just use a different,
descriptive name for your migration class. Something like:

class BasicFields  V 1.0
end

class SomeFieldsMarketingSaidWeNeeded  V 1.1
end


See? You are defining a class, but really just treat that class name as a
descriptor for the purpose of your migration. It's not going to be used
anywhere - you aren't really ever going to manually instantiate the
migration, and Camping knows what to do.

If this isn't your problem, then I sincerely apologize for wasting your
valuable time. Go get those little wheels!

3 Ken


On Fri, Jun 28, 2013 at 9:21 AM, Lázaro Armando netad...@lex-sa.cu wrote:

 Hi

 I'm trying to add a column in to my model, just write a BasicFields V 1.1
 in to my models but when running camping it return this error

 deisi.rb:722:in `module:Models': superclass mismatch for class
 BasicFields (TypeError)
 from deisi.rb:688:in `module:Deisi'
 from deisi.rb:15:in `top (required)'
 from
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1.532/lib/camping/reloader.rb:98:in
 `load'
 from
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1.532/lib/camping/reloader.rb:98:in
 `load_file'
 from
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1.532/lib/camping/reloader.rb:60:in
 `load_apps'
 from
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1.532/lib/camping/reloader.rb:124:in
 `reload!'
 from
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1.532/lib/camping/server.rb:134:in
 `start'
 from
 /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:141:in
 `start'
 from
 /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1.532/bin/camping:9:in `top
 (required)'
 from /usr/local/bin/camping:23:in `load'
 from /usr/local/bin/camping:23:in `main'


 That only happen if I have 1.0 and 1.1 declared, after delete 1.0 that
 error is banished

 My question:

 I must delete the old BasicFields class?

 ___
 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

  1   2   3   4   5   6   7   8   9   10   >