my rails .gitignore 2
config/database.yml *~ *.cache *.log *.pid tmp/**/* .DS\_Store db/cstore/** doc/api doc/app doc/plugins coverage/* db/*.sqlite3 *.tmproj Capfile
usually I leave a config/database.yml.example, you can extend this list also to ignore the schema.rb.
edge rails should be able to recreate missing directory, because as you know git won’t follow empty directories, if that’s the case, just touch a .gitignore in tmp and log directories.
extra trick: to always ignore those files globally:
git config --global core.excludesfile /path/to/.gitignore
update:
suggested by schram:
doc/*.dot
to ignore railroad files
also for somebody is useful to have the sqlite production database versioned, so remove db/*.sqlite3.
another update:
ignored vim swap files
*.sw?
rails 2.2 i18n for the impatients
it’s all very straightforward and you can taste it already, grab a copy of edge rails and do this:
create a directory called "locale" in lib, and place two files, for example en-US.rb and it-IT.rb
Inside write:
# en-US.rb
I18n.store_translations 'en-US',
:yes => "yes",
:no => "no",
:action_show => "show",
:welcome => 'Welcome {{name}}!',
:inbox => ['1 message', '{{count}} messages']
as you can see we now have some symbol with our translation, do the same for it-IT.
it’s worth noticing the last two lines, {{name}} is a placeholder, let’s see how the things works.
open your ApplicationHelper and use this shortcut
def t(*args)
translate(*args)
end
after that open a view and put this:
t(:welcome, :name => "kain") # sorry for the formatting
next: ApplicationController
before_filter :set_locale
def set_locale
default_locale = 'en-US'
locale = params[:locale] || session[:locale] || (this_user.site_language if is_logged_in?) || default_locale
session[:locale] = locale
I18n.locale = locale
I18n.populate do
require "lib/locale/#{locale}.rb" # << WARNING: this is dangerous, change the method to load libs, maybe initializer
end
end
voilà, all done.
thanks to http://almosteffortless.com/2008/07/21/simple-localization-in-rails-22/
Troubles with ssh public key authentication
1) Always read your secure(.log) on your server
2) Do this in your server:
chmod go-w ~/ chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys
Chances are that you know what I’m talking about.
keep an eye into your plesk's qmail logs
Create a file check_maillog in /usr/local/sbin or where do you prefer, make it executable and wrote in it:
tail -f /usr/local/psa/var/log/maillog /var/spool/qscan/qmail-queue.log /var/spool/qscan/quarantine.log /var/log/clamav/clamd.log /var/log/clamav/freshclam.log
Remove every file that a .pkg provides
lsbom -f -l -s /Library/Receipts/package_here.pkg/Contents/Archive.bom | (cd /; sudo xargs rm)
CentOS 5 gem install mysql problems? 2
checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... yes checking for mysql_query() in -lmysqlclient... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
Be sure to have mysql and mysql-devel packages, and install the gem with
gem install mysql -- --with-mysql-include=/usr/include/mysql --with-mysql-lib=/usr/lib/mysql
rails timestamped migrations optionals
For some reason you don’t like timestamped migrations in rails?
Looking for a way to use integers again?
Grab off the latest rails edge and set:
config.active_record.timestamped_migrations = false
Passenger (aka mod_rails) PATH on Leopard 1
Passenger uses a little subset of your PATH.
So if you have installed ruby, gem and misc binaries in other paths you cannot access them via your passenger rails application.
Here comes a solution, create an executable script ruby_with_env, I wrote it in my /usr/local/bin:
#!/bin/bash export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/graphviz/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin:/usr/local/git/bin/ :$PATH" /usr/local/bin/ruby $*
Now point the file to your PassengerRuby directive in your apache configuration file and restart.
no such file to load -- sqlite3/database 7
[kain@kain-osx:/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2]$ sudo find . -perm 0662 -exec chmod 664 {} \;
Update: Ruby Enterprise Edition is ahead of all: link
Another update: This is now fixed http://weblog.jamisbuck.org/2008/8/27/sqlite3-ruby-1-2-3
ultrasphinx facet search issue 1
As of now seems like ultrasphinx raises an error when rebuilding facet cache.
Exploring the source seems that the plugin always wants the parameter :as, so:
{:field => "ejection_fraction", :facet => true, :sortable => true, :as => "ejection_fraction"},
Also will_paginate has changed its API a little bit, it’s more a cosmetic change but necessary to avoid some logging noise in ultrasphinx. Hope to have the time to write a little patch soon.
Older posts: 1 2