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

Reply via email to