I want to match a url field against a url prefix (which may contain percent signs), e.g. .where("url LIKE ?", "#{some_url}%"). What's the most Rails way?
Jack of all Trades, Professional Software Craftsman Sometimes, using the good old ‘auto increment’ from your database just isn’t good enough. If you really require that all your objects have unique ID, even across systems and different databases there’s only one way go: UUID or Universally Unique IDentifier. A UUID is generated in such a way that every generated UUID in the world is unique. For ex
If you need to use an explicit primary key and not an AUTO_INCREMENT with ActiveRecord I wrote this snippet that has proved very handy: module ExplicitPrimaryKey attr_accessor :pk def before_create; self.id = pk; end end Then when you call the create method supply :pk => value along with the other values. ActiveRecord is an ORM solution that grew out of Ruby on Rails. It is entirely separate and c
http://activetokyocabi.rubyforge.org/ ActiveTokyoCabinet 0.1.1をリリースしました。 これは何? ActiveRecordのTokyo(Cabinet|Tyrant)のテーブルデータベースのアダプタです。 TokyoTyrantをActiveRecordのように使えるMiyazakiResistanceもあるんですが、アダプタとして実装した方がよりシームレスだろうと思って作ってみました。 使い方 database.ymlの書き方は次の通り。 TykyoCabinetでは1ファイルを1テーブルとしています。 また、TokyoTyrantではサーバ1台を1テーブルとしています。 # TokyoCabinet development: adapter: tokyocabinet database: path_of_database_di
ActiveTokyoCabinet - a library for using Tokyo(Cabinet|Tyrant) under ActiveRecord. Copyright © 2010 SUGAWARA Genki Description ActiveTokyoCabinet is a library for using Tokyo(Cabinet|Tyrant) under ActiveRecord. ActiveTokyoCabinet depend on Tokyo(Cabinet|Tyrant). see 1978th.net/tokyocabinet/ , 1978th.net/tokyotyrant/ Project Page rubyforge.org/projects/activetokyocabi Install gem install activetok
Welcome to Strictly Untyped, the place to discover our latest reviews across a wide range of literature. We try to provide a detailed and comprehensive analysis and review of all the books we choose to look at on this site. This fantastic little pocket guide is designed specifically to help people pass hair follicle drug tests the right way, relieving stress and boasting amazing results. The book
I don’t really understand why people use namespaced models. I see ActiveRecord models as DSL for database. There is no concept of namespacing in Database, then why should you have them with models ? Apart from that, they are very buggy too ! “I am generally not a huge fan of namespaces for models. As I don’t think that’s a good fit for splitting up your domain.” - DHH From what I’ve seen, the mos
HumanAttributeOverride ================ Read a tutorial for this plugin at http://weblog.redlinesoftware.com/2008/1/2/human-attribute-override-plugin-tutorial Updates Nov. 14, 2007 Fixed a bug where column.human_name didn’t use the new attribute name. This should now produce the correct results: <% for column in Company.content_columns %> <%= column.human_name %> <% end %> Aug. 18, 2007 Attributes
I recently wanted to change how a database column name is represented in validation messages. Case in point: I wanted the "email" column to give error messages like "E-mail address must be valid". I poked through the Rails code, and it turns out this is very simple. The method seems underdocumented/underblogged though, so I thought I'd write it up. What you do is define a human_attribute_name meth
A small useful tip: Mysql’s query planner occasionally has trouble picking the right index. I’ve found that normally if you try variations long enough, eventually you find a way to do the right thing. Recently however I ran into one I couldn’t coax. No big deal you say, after all, that’s what find_by_sql is for no? Only problem is, the query in question was inside a with_scope block, and I really
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く