you have to combine Rails and LaTeX (which also requires a ~1GB installation of a recent TeX distribution)
I won't mention the higher memory and CPU requirements when compiling the PDF file... ;-)
using TeX for PDF and Morris/g.raphaël/whatever for HTML of course means maintaining two interfaces for your data (have fun extracting that into a gem ;-))
It's more of an advanced task (not the Ruby/Rails part, but the LaTeX one), but if you value the high quality of TeX'ed documents, it's definitely the way you should go.
Using v8 on the other hand sounds far to nice to be true :-)
A small side note: On Debian/Ubuntu/Mint Linux, you'll need libpq-dev (Postgres headers) to install the pg gem, not libpg.... That annoys me every time I setup a new server... ;-)
I've built a more colorful formatter. This code might be not optimized yet, since I didn't investigate the type of severity (nor did I for Logger::Severity::DEBUG and friends).
Maybe you'll find it useful, too ;-)
log_formatter.rb
classLogger::SimpleFormatter# from activesupport/lib/active_support/core_ext/logger.rbdefcall(severity, time, progname, msg)
"#{severity_color severity}#{String === msg ? msg : msg.inspect}\n"end
private
defseverity_color(severity)
case severity
when"DEBUG""\033[0;34;40m[DEBUG]\033[0m"# bluewhen"INFO""\033[1;37;40m[INFO]\033[0m"# bold whitewhen"WARN""\033[1;33;40m[WARNING]\033[0m"# bold yellowwhen"ERROR""\033[1;31;40m[ERROR]\033[0m"# bold redwhen"FATAL""\033[7;31;40m[FATAL]\033[0m"# bold black, red bgelse"[#{severity}]"# noneendendend
Any idea, why localizing nested attributes is unbelievable painful? Consider this setup, where you need a lot of repetition to create correctly localized error messages.
That also crossed my mind, but in this case it basically adds complexity. Instead of a Rails.env.demo?, I would have a rollout? helper call and an overhead through the feature set management (the demo-abilities won't change over time)
I've also thought of a custom form builder to shrink down the view overhead—but then I still need a comfortable way to define the accessibility restrictions…
Is there a convenient way to separate view and controller logic depending on the environment? I have, for example, a "demo" environment which limits some of the functionality of the app. In result, I have many snippets like
ruby
# in a view
<% ifRails.env.demo? %>
<dt>Amount (fixed in demo)</dt>
<dd>2</dd>
<% else%>
<dt><%= f.label :amount %></dt>
<dd><%= f.text_field :amount %></dd>
<% end %>
and a corresponding conditional in the controller (+ some modified models – but I don't think, there is a way around different behavior, is it?), which is some kind of messy, especially if only some fields are going to be unchangeable in the demo environment.
Maybe CanCan 2.0 could be a solution, since then the "demo abilities" are more or less centralized... But: would that be the right way?
I often use FriendlyId in combination with a UUID column. This way, the guessing of further resources is much harder (cp. /foo/1 → /foo/2 with random, 32-digit identifiers). Of course you will still need a authorization mechanism...
Thanks! config.assets.compile = true + config.assets.digest = true saved my day. Lost hours yesterday figuring out, why stylesheet_link_tag 'application' had refused to link /assets/application-md5hash.css...
Usually, I stick with LaTeX and PGF/TikZ to produce PDF graphs.
This has some disadvantages, though:
It's more of an advanced task (not the Ruby/Rails part, but the LaTeX one), but if you value the high quality of TeX'ed documents, it's definitely the way you should go.
Using v8 on the other hand sounds far to nice to be true :-)
or
You mentioned Rubinius/JRuby - how about an episode deploying to these platforms?
Great episode!
A small side note: On Debian/Ubuntu/Mint Linux, you'll need
libpq-dev
(Postgres headers) to install thepg
gem, notlibpg...
. That annoys me every time I setup a new server... ;-)I've built a more colorful formatter. This code might be not optimized yet, since I didn't investigate the type of
severity
(nor did I forLogger::Severity::DEBUG
and friends).Maybe you'll find it useful, too ;-)
That qualifies for »abandoned«, in my opinion ;-)
I had have also trouble to install
ruby-debug19
on some Debian machines with Ruby 1.9.2 using either RVM or rbenv.debugger
works like a charm :-)Nice-to-know episode! Any idea, why ruby-debug19 was abandoned?
—Dominik
Any idea, why localizing nested attributes is unbelievable painful? Consider this setup, where you need a lot of repetition to create correctly localized error messages.
Am I doing it wrong?
With #334, I figured out, that I have used the »compass« and not the »compass-rails« gem...
So far, the
@import 'icons/*.png'
had always failed... Now I know better ;-)I'd really like to see a COMPASS introduction, too. In particular I'm having trouble to setup image sprites...
That also crossed my mind, but in this case it basically adds complexity. Instead of a
Rails.env.demo?
, I would have arollout?
helper call and an overhead through the feature set management (the demo-abilities won't change over time)I've also thought of a custom form builder to shrink down the view overhead—but then I still need a comfortable way to define the accessibility restrictions…
—Dominik
Is there a convenient way to separate view and controller logic depending on the environment? I have, for example, a "demo" environment which limits some of the functionality of the app. In result, I have many snippets like
and a corresponding conditional in the controller (+ some modified models – but I don't think, there is a way around different behavior, is it?), which is some kind of messy, especially if only some fields are going to be unchangeable in the demo environment.
Maybe CanCan 2.0 could be a solution, since then the "demo abilities" are more or less centralized... But: would that be the right way?
—Dominik
I often use FriendlyId in combination with a UUID column. This way, the guessing of further resources is much harder (cp. /foo/1 → /foo/2 with random, 32-digit identifiers). Of course you will still need a authorization mechanism...
Thanks!
config.assets.compile = true
+config.assets.digest = true
saved my day. Lost hours yesterday figuring out, whystylesheet_link_tag 'application'
had refused to link/assets/application-md5hash.css
...