in-seok hwang | 5 Feb 2010 10:59
Picon

I want to use camping 2.0

Hi ,all

I want some advice about upgrade camping version.

My server used camping-1.5.180  and mongrel-1.1.5, activerecord-2.1.1, markaby-0.5

But, that is very old .

So , i tried to update camping version ( 1.5.180 -> 1.9.300) and i has many problem.

two version are so different.

so i had to give up was updated.

Now i would like to try the update again.(camping 2.0)

i have two question.

what is the difference between the two version ( 1.5.180 and 2.0) ?

new version(2.0) of the old version ( 1.5.180) of the website should create a new one?
Some small modifications to the source is not possible to update do?

plz give me hint.

My English is not enough.
Sorry.

_______________________________________________
Camping-list mailing list
Camping-list@...
http://rubyforge.org/mailman/listinfo/camping-list
Dave Everitt | 5 Feb 2010 11:17
Picon
Gravatar

Re: I want to use camping 2.0

Hi - take a look here:

http://stuff.judofyr.net/camping-docs/book/51_upgrading.html#from-15- 
to-20

DaveE

> what is the difference between the two version ( 1.5.180 and 2.0) ?
David Susco | 19 Feb 2010 20:59
Picon

going into production, a few questions

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

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

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

--

-- 
Dave
Magnus Holm | 19 Feb 2010 21:13
Picon
Gravatar

Re: going into production, a few questions

404 on 1.5:
module App::Controllers
  class NotFound
    def get(path)
      "Do something with path"
    end
  end
end

404 on 1.9/2.0:
module App
  def r404(path)
    "Do something with path"
  end
end

There appears to be two solutions: Call ActiveRecord::Base.verify_active_connections! before every request (I think this is what Rails does by default):

module VerifyConnection
  def service(*args)
    ActiveRecord::Base.verify_active_connections!
  ensure
    return super
  end
end

module App
  include VerifyConnection
end

Or, pass reconnect => true to establish_connection.

I'm not quite sure what's best…

// Magnus Holm


On Fri, Feb 19, 2010 at 20:59, David Susco <dsusco <at> gmail.com> wrote:
I have a few camping projects that are about to go into production in
a few weeks, just picking your brains to see if I can add some
robustness.

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

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

--
Dave
_______________________________________________
Camping-list mailing list
Camping-list-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/camping-list

_______________________________________________
Camping-list mailing list
Camping-list@...
http://rubyforge.org/mailman/listinfo/camping-list
David Susco | 19 Feb 2010 21:51
Picon

Re: going into production, a few questions

Thanks on the 404 stuff, that was easy.

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

Dave

On Fri, Feb 19, 2010 at 3:13 PM, Magnus Holm <judofyr@...> wrote:
> 404 on 1.5:
> module App::Controllers
>   class NotFound
>     def get(path)
>       "Do something with path"
>     end
>   end
> end
> 404 on 1.9/2.0:
> module App
>   def r404(path)
>     "Do something with path"
>   end
> end
> There appears to be two solutions:
> Call ActiveRecord::Base.verify_active_connections! before every request (I
> think this is what Rails does by default):
> module VerifyConnection
>   def service(*args)
>     ActiveRecord::Base.verify_active_connections!
>   ensure
>     return super
>   end
> end
> module App
>   include VerifyConnection
> end
> Or, pass reconnect => true to establish_connection.
> I'm not quite sure what's best…
> // Magnus Holm
>
>
> On Fri, Feb 19, 2010 at 20:59, David Susco <dsusco@...> wrote:
>>
>> I have a few camping projects that are about to go into production in
>> a few weeks, just picking your brains to see if I can add some
>> robustness.
>>
>> What's the best way to catch any "Camping Problem! /XXX not found"
>> errors that a user might see if they start typing URLs themselves?
>> Ideally I'd just like to redirect them all to some general index
>> controller.
>>
>> I'm using MySQL for my database. I'm getting a few "MySQL server has
>> gone away" error messages every now and then. I did some searching and
>> found if "reconnect: true" is in the hash I send to
>> establish_connection that I should be all set. Can anyone confirm?
>> Also, any other MySQL connection "best practices" that I should be
>> following?
>>
>> --
>> Dave
>> _______________________________________________
>> Camping-list mailing list
>> Camping-list@...
>> http://rubyforge.org/mailman/listinfo/camping-list
>
>
> _______________________________________________
> Camping-list mailing list
> Camping-list@...
> http://rubyforge.org/mailman/listinfo/camping-list
>

--

-- 
Dave
David Susco | 3 Mar 2010 16:43
Picon

sending data/overriding response headers?

Hey guys,

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

ActionController has send_data:

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

Is there something similar built into Camping?

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

--

-- 
Dave
Magnus Holm | 3 Mar 2010 17:11
Picon
Gravatar

Re: sending data/overriding response headers?

Sure, just make sure to enable X-Sendfile in Apache/Nginx, and then set it yourself:


  def get
     <at> headers['X-Sendfile'] = "/full/path/to/file"
     <at> headers['Content-Type'] = "text/plain; charset=utf-8"
  end

Or if you want Rack to figure out which Content-Type to send:

  file = "/full/path/to/file"
   <at> headers['X-Sendfile'] = file
   <at> headers['Content-Type'] = Rack::Mime.mime_type(File.extname(file)) + "; charset=utf-8"

If you ever need to send custom headers, just use the <at> headers hash.

// Magnus Holm


On Wed, Mar 3, 2010 at 16:43, David Susco <dsusco-Re5JQEeQqe8@public.gmane.orgm> wrote:
Hey guys,

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

ActionController has send_data:

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

Is there something similar built into Camping?

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

--
Dave
_______________________________________________
Camping-list mailing list
Camping-list-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/camping-list

_______________________________________________
Camping-list mailing list
Camping-list@...
http://rubyforge.org/mailman/listinfo/camping-list
Julik Tarkhanov | 3 Mar 2010 17:04
Picon

Re: sending data/overriding response headers?


On 3 mrt 2010, at 16:43, David Susco wrote:

> Is there something similar built into Camping?

Before it was so that you could return an IO object from your action  
and it would just work. Dunno if Camping 2 still supports this. A  
Content-Disposition header would be in order
so that your clients download a proper filename.

--

-- 
Julik Tarkhanov
me@...
Magnus Holm | 3 Mar 2010 17:20
Picon
Gravatar

Re: sending data/overriding response headers?

In Camping 2 you can return an object which responds to #each and the server will then stream it to the client. If you want the file to trigger a download-box on the user, you'll have to send Content-Disposition as Julik mentioned.


Something like this should work, although I'm not 100% sure:

   <at> headers['Content-Disposition'] = 'attachment; filename=table.csv'

// Magnus Holm


On Wed, Mar 3, 2010 at 17:04, Julik Tarkhanov <julian.tarkhanov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

On 3 mrt 2010, at 16:43, David Susco wrote:

Is there something similar built into Camping?


Before it was so that you could return an IO object from your action and it would just work. Dunno if Camping 2 still supports this. A Content-Disposition header would be in order
so that your clients download a proper filename.

--
Julik Tarkhanov
me-RY+snkucC20@public.gmane.org






_______________________________________________
Camping-list mailing list
Camping-list <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

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

Gmane