<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3928934694684681974</id><updated>2011-07-28T07:42:34.047-07:00</updated><category term='mobile'/><category term='install'/><category term='templates'/><category term='-c'/><category term='path'/><category term='auto_complete'/><category term='active record base'/><category term='attachement_fu'/><category term='autotest'/><category term='strategy'/><category term='relationships'/><category term='migrate'/><category term='AMP'/><category term='pkg'/><category term='array'/><category term='sessions'/><category term='remove_table'/><category term='branches'/><category term='form_for'/><category term='YML'/><category term='add_index'/><category term='with'/><category term='has_many'/><category term='database time'/><category term='render'/><category term='git'/><category term='error_messages_on'/><category term='gem'/><category term='spam'/><category term='makefile'/><category term='user time'/><category term='closures'/><category term='RAILS_ENV'/><category term='wget'/><category term='freeze'/><category term='uninstall'/><category term='generate'/><category term='add_column'/><category term='table'/><category term='rails 2.0.2'/><category term='urls'/><category term='auto complete'/><category term='logout'/><category term='ignore'/><category term='CSS'/><category term='mysql'/><category term='refactoring'/><category term='session attack'/><category term='rails 2.1'/><category term='commit'/><category term='ssh-keygen'/><category term='ActionView Base'/><category term='textmate'/><category term='Perl'/><category term='lambda'/><category term='sendmail'/><category term='forgery'/><category term='user'/><category term='scaffold'/><category term='spec_helper.rb'/><category term='nested'/><category term='rspec'/><category term='controller'/><category term='except'/><category term='ImageMagick'/><category term='text'/><category term='aggregate'/><category term='routes.rb'/><category term='pagenate'/><category term='view'/><category term='mac'/><category term='cc'/><category term='stuck'/><category term='memcached'/><category term='associations'/><category term='checkout'/><category term='modeling'/><category term='assembla'/><category term='methods'/><category term='acts_as_taggable_on_steroids'/><category term='leopard 10.5'/><category term='related'/><category term='gotcha'/><category term='strftime'/><category term='svn'/><category term='ruby'/><category term='RMagick'/><category term='trunk'/><category term='maping'/><category term='setup'/><category term='blocks'/><category term='csrf'/><category term='has_many_and_belongs_to'/><category term='javascript'/><category term='spec'/><category term='developing'/><category term='will_pagenate'/><category term='add'/><category term='import'/><category term='load'/><category term='spin'/><category term='environment'/><category term='detect'/><category term='restful_authentication'/><category term='form'/><category term='routes'/><category term='plugin'/><category term='mapping objects'/><category term='rename_column'/><category term='ordinalize'/><category term='file'/><category term='repository'/><category term='rake'/><category term='database'/><category term='manual'/><category term='deploy'/><category term='created_at'/><category term='login'/><category term='cookies'/><category term='add_primary_key'/><category term='handy methods'/><category term='setup.rb'/><category term='ssh'/><category term='calls'/><category term='gsub'/><category term='only'/><category term='value object'/><category term='options'/><category term='time'/><category term='applicationcontroller'/><category term='named_scope'/><category term='tags'/><category term='singular'/><category term='beginning_of_day'/><category term='upload'/><category term='dont'/><category term='composed_of'/><category term='public instance methods'/><category term='gcc'/><category term='belongs_to'/><category term='add_table'/><category term='opensolaris'/><category term='macports'/><category term='model'/><category term='cheatsheet'/><category term='java script'/><category term='capistrano'/><category term='rjs'/><title type='text'>jason's rails blog</title><subtitle type='html'>This is absolutely a private note pad for my use only - it is just a list of things that I took ages to find out OR don't want to forget all in one place for me to refer to later. Anyone who finds it can read it - and thats all. Don't come crying to me about anything in it. I did not write for you or the world.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>59</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-4772674844195683132</id><published>2008-12-03T07:07:00.000-08:00</published><updated>2008-12-03T07:08:19.000-08:00</updated><title type='text'>Start/Stop Mysql on Leopard</title><content type='html'>sudo /usr/local/mysql/support-files/mysql.server start&lt;br /&gt;&lt;br /&gt;sudo /usr/local/mysql/support-files/mysql.server stop&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-4772674844195683132?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/4772674844195683132/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=4772674844195683132' title='40 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/4772674844195683132'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/4772674844195683132'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/12/startstop-mysql-on-leopard.html' title='Start/Stop Mysql on Leopard'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>40</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-870756644067475410</id><published>2008-11-13T13:56:00.000-08:00</published><updated>2008-11-13T14:09:24.366-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rspec'/><title type='text'>Rspec installation</title><content type='html'>&lt;pre style="font-family: verdana; color: rgb(0, 0, 0);"&gt;&lt;span style="font-size:78%;"&gt;&gt;sudo gem install ZenTest&lt;br /&gt;&gt;sudo gem install rspec-rails&lt;br /&gt;&lt;br /&gt;in application root:&lt;br /&gt;&gt;ruby script/generate rspec&lt;br /&gt;&lt;br /&gt;autotest         (if it hangs use &gt;RSPEC=true autotest)&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="background-color: rgb(255, 255, 102);"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;rake spec&lt;br /&gt;rake spec:app&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="background-color: rgb(255, 255, 102);"&gt;&lt;br /&gt;&lt;/span&gt;rake spec:models&lt;br /&gt;rake spec:controllers&lt;br /&gt;rake spec:views&lt;br /&gt;rake spec:helpers&lt;br /&gt;rake spec:plugins&lt;br /&gt;rake --tasks:plugins&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-870756644067475410?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/870756644067475410/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=870756644067475410' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/870756644067475410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/870756644067475410'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/11/rspec-installation.html' title='Rspec installation'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-987785173521499666</id><published>2008-11-07T06:22:00.000-08:00</published><updated>2008-11-07T06:43:24.241-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='database time'/><category scheme='http://www.blogger.com/atom/ns#' term='user time'/><category scheme='http://www.blogger.com/atom/ns#' term='time'/><category scheme='http://www.blogger.com/atom/ns#' term='strftime'/><title type='text'>Compare time</title><content type='html'>&lt;span style="font-size:78%;"&gt;&lt;span style="font-family: verdana;"&gt;module ApplicationHelper&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;..SOMETIME_FORMAT = "%a %b %d %H:%M:%S %z %Y"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;..SOMETIME_FORMAT_DB = '%Y-%m-%d %H:%M:%S'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;..def sometime_this_month(time, format='user')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;....return time.beginning_of_month.strftime(SOMETIME_FORMAT) if format == 'user'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;....return time.beginning_of_month.strftime(SOMETIME_FORMAT_DB) if format == 'db'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;..end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;..def sometime_today(time, format='user')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;....return time.beginning_of_day.strftime(SOMETIME_FORMAT) if format == 'user'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;....return time.beginning_of_day.strftime(SOMETIME_FORMAT_DB) if format == 'db'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;..end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family: verdana;"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family: verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family: verdana;"&gt;&lt;br /&gt;&lt;br /&gt;Time based finds.&lt;br /&gt;&lt;br /&gt;created_at time from the database is: "2008-10-24 22:06:18 +0200" &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family: verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family: verdana;"&gt;However retrieving the Time.now results in the format as follows: "Fri Nov 07 15:31:56 +0100 2008"&lt;br /&gt;&lt;br /&gt;end&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family: verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-987785173521499666?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/987785173521499666/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=987785173521499666' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/987785173521499666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/987785173521499666'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/11/compare-time.html' title='Compare time'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-5742575625384415205</id><published>2008-11-07T06:14:00.000-08:00</published><updated>2008-11-07T06:21:32.567-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='named_scope'/><title type='text'>Named scope with variables</title><content type='html'>&lt;span style="font-size:78%;"&gt;&lt;span style="font-family: verdana;"&gt;in model *.rb (in this case weight_meassurements.rb)&lt;br /&gt;&lt;br /&gt;named_scope :user_weight_meassurements, lambda { |user_id| { :order =&gt; 'created_at DESC', :conditions =&gt; ["user_id == ?", user_id] } }&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: verdana;"&gt;named_scope :today, lambda { |today| { :conditions =&gt; ["created_at &gt; ?", today] } }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family: verdana;"&gt;Calling from the controllers or helpers @user.weight_meassurements.today('2008-11-07 00:00:00') wil retrieve all weight_meassurement record belonging to the user created after midnight of the passed date. &lt;br /&gt;&lt;br /&gt;You can also call WeightMeassurements.user_weight_meassurements(@user.id) for all this user weight meassurement records. &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-5742575625384415205?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/5742575625384415205/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=5742575625384415205' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/5742575625384415205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/5742575625384415205'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/11/named-scope-with-variables.html' title='Named scope with variables'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-6239878060994759835</id><published>2008-10-27T22:06:00.000-07:00</published><updated>2008-10-27T22:09:58.009-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='import'/><title type='text'>Mysql import</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;b style="color: black; background-color: rgb(255, 255, 102); font-family: verdana;"&gt;mysql&lt;/b&gt;&lt;span style="font-family:verdana;"&gt; -p -u{Benutzername} {DB-Name} &amp;#60; filename&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-6239878060994759835?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/6239878060994759835/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=6239878060994759835' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6239878060994759835'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6239878060994759835'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/10/mysql-import.html' title='Mysql import'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-6177952897480871823</id><published>2008-10-27T02:53:00.000-07:00</published><updated>2008-10-27T03:19:01.390-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='created_at'/><category scheme='http://www.blogger.com/atom/ns#' term='ordinalize'/><category scheme='http://www.blogger.com/atom/ns#' term='time'/><category scheme='http://www.blogger.com/atom/ns#' term='beginning_of_day'/><category scheme='http://www.blogger.com/atom/ns#' term='strftime'/><title type='text'>Converting database time to human time</title><content type='html'>&lt;span style="font-family: verdana;font-size:85%;" &gt;model.created_at.begining_of_day.strftime(%B, %Y)&lt;br /&gt;&gt;October, 2008&lt;br /&gt;model.creted_at.strftime("%d").to_i.ordinalize&lt;br /&gt;&gt;25th&lt;br /&gt;&lt;br /&gt;%a  weekday name.&lt;br /&gt;%A  weekday name (full).&lt;br /&gt;%b  month name.&lt;br /&gt;%B  month name (full).&lt;br /&gt;%c  date and time (locale)&lt;br /&gt;%d  day of month [01,31].&lt;br /&gt;%H  hour [00,23].&lt;br /&gt;%I  hour [01,12].&lt;br /&gt;%j  day of year [001,366].&lt;br /&gt;%m  month [01,12].&lt;br /&gt;%M  minute [00,59].&lt;br /&gt;%p  AM or PM&lt;br /&gt;%S  Second [00,61]&lt;br /&gt;%U  week of year (Sunday)[00,53].&lt;br /&gt;w  weekday [0(Sunday),6].&lt;br /&gt;W  week of year (Monday)[00,53].&lt;br /&gt;x  date (locale).&lt;br /&gt;%X  time (locale).&lt;br /&gt;%y  year [00,99].&lt;br /&gt;%Y  year [2000].&lt;br /&gt;%Z  timezone name.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-6177952897480871823?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/6177952897480871823/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=6177952897480871823' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6177952897480871823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6177952897480871823'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/10/converting-database-time-to-human-time.html' title='Converting database time to human time'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-7211559706151473714</id><published>2008-10-16T03:07:00.000-07:00</published><updated>2008-10-16T03:18:31.207-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='memcached'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.1'/><title type='text'>Memcache Rails</title><content type='html'>&lt;span style="font-family: verdana;font-size:85%;" &gt;&gt;sudo port install memcached&lt;br /&gt;&gt;/opt/local/bin/memcached -d -m 64 -u www -l &lt;yourip&gt; -p 11211&lt;br /&gt;&lt;br /&gt;see also&lt;br /&gt;/Library/LaunchDaemons/org.macports.memcached.plist&lt;br /&gt;memcached -h&lt;br /&gt;man memcached&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-7211559706151473714?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/7211559706151473714/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=7211559706151473714' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7211559706151473714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7211559706151473714'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/10/memcache-rails.html' title='Memcache Rails'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-3167923045981594294</id><published>2008-10-13T22:40:00.000-07:00</published><updated>2008-10-13T23:48:05.000-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cookies'/><category scheme='http://www.blogger.com/atom/ns#' term='strategy'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='applicationcontroller'/><title type='text'>Session Cookies and Application Strategy</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;- &lt;span style="font-weight: bold;"&gt;Do you need protection_forgery? Yes!&lt;/span&gt;&lt;br /&gt;- &lt;span style="font-weight: bold;"&gt;Does a browser need cookies turned on? Yes!&lt;/span&gt;&lt;br /&gt;- &lt;span style="font-weight: bold;"&gt;Is there no otherway around it? No!&lt;/span&gt;&lt;br /&gt;Passing infomation in the url is neiter restful, nor safe!&lt;br /&gt;- &lt;span style="font-weight: bold;"&gt;What about people that have their cookies turned off? &lt;/span&gt;&lt;br /&gt;We have to give let them know that cookies are safe in the contect of our application, and they hold no personal information and they are encrypted.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;- What about mobile phone browsers that mostly have no cookie capabilities?&lt;/span&gt;&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;Same as cookies turned off, may adding somthing about mobile phones too.&lt;br /&gt;OR&lt;br /&gt;The user can set up his account as "Mobile Phone Enabled" from a web browser and tell them about the cookie problem, but give them the solution to have the application use IP as the cooke key - with the small problem that if thier provider issues them with a new IP during the session, they will have to relogin.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://dict.leo.org/ende?lp=ende&amp;amp;p=thMx..&amp;amp;search=encrypted"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-3167923045981594294?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/3167923045981594294/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=3167923045981594294' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3167923045981594294'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3167923045981594294'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/10/session-cookies-and-application.html' title='Session Cookies and Application Strategy'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-8406627648651240021</id><published>2008-10-13T22:29:00.000-07:00</published><updated>2008-10-13T23:43:56.337-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cookies'/><category scheme='http://www.blogger.com/atom/ns#' term='detect'/><title type='text'>Better Cookie Detect</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;In some cases, you might really really want to know it the visiting browser has thier cookies on or off. One reason that I an think off is that you are using some ajax stuff on your the landing page that lets unregistered users edit a list or somthing.&lt;br /&gt;&lt;br /&gt;This is a way of doing it.&lt;br /&gt;&lt;br /&gt;1. Check to see if a cookie has been set for the session,&lt;br /&gt;2. if not then check to see if this ip is in the middle of cookie detection&lt;br /&gt;3. if not then redirect to a method and check again - if no cookies are on now, then be sure they are off.&lt;br /&gt;&lt;br /&gt;Now you can either ask them to put them on to gain full functionallity of the application, or let the application blend out functions that cause UPDATE, PUT or DESTROY requests and instead show a flash error message that informs them of the reduced functionality.&lt;br /&gt;&lt;br /&gt;This means that you will force a redirect on each request for browsers that have thier cookies off.&lt;br /&gt;&lt;br /&gt;In the application.rb add the following:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;before_filter :cookies_required, :except =&gt; [:check_for_cookies]&lt;br /&gt;&lt;br /&gt;protected&lt;br /&gt;&lt;br /&gt;def cookies_on?&lt;br /&gt;..!request.cookies["_yourapp_session"].to_s.blank?&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;def cookies_required&lt;br /&gt;..return unless request.cookies["_yourapp_session"].to_s.blank?&lt;br /&gt;..if DetectCookie.find_and_destroy_or_create_by_remote_ip(request.remote_ip, request.request_uri) then return end&lt;br /&gt;..session[:return_to] = request.request_uri&lt;br /&gt;..redirect_to detect_cookies_path&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&gt;ruby script/generate model DetectCookie remote_ip:string request_uri:string&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&gt;rake db:migrate&lt;br /&gt;&lt;br /&gt;Create a controller: dectect_cookies.rb&lt;br /&gt;add the following:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;class DetectCookiesController &lt; ApplicationController&lt;br /&gt;..before_filter :cookies_required, :except =&gt; :show&lt;br /&gt;&lt;br /&gt;..def show&lt;br /&gt;....if request.cookies["_hausursel_session"].to_s.blank? #change to your cookie session name&lt;br /&gt;......detect_cookie=DetectCookie.find_by_remote_ip(request.remote_ip)&lt;br /&gt;......detect_cookie ? redirect_to(detect_cookie.request_uri) : redirect_to(cookie_path)&lt;br /&gt;....else&lt;br /&gt;......redirect_back_or_default(:controller =&gt; 'apartments')&lt;br /&gt;....end&lt;br /&gt;..end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;Add the following to the detect_cokkie.rb file in the models folder:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;class DetectCookie &lt; ActiveRecord::Base&lt;br /&gt;&lt;br /&gt;..def DetectCookie.find_and_destroy_or_create_by_remote_ip(remote_ip, request_uri)&lt;br /&gt;....if detect_cookie=DetectCookie.find_by_remote_ip(remote_ip)&lt;br /&gt;......DetectCookie.destroy(detect_cookie.id)&lt;br /&gt;......true&lt;br /&gt;....else&lt;br /&gt;......DetectCookie.create(:remote_ip=&gt; remote_ip, :request_uri =&gt; request_uri)&lt;br /&gt;......false&lt;br /&gt;....end&lt;br /&gt;..end&lt;br /&gt;&lt;br /&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-8406627648651240021?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/8406627648651240021/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=8406627648651240021' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/8406627648651240021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/8406627648651240021'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/10/complex-cookie-detect.html' title='Better Cookie Detect'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-5506092182921554982</id><published>2008-10-11T14:27:00.000-07:00</published><updated>2008-10-13T22:29:33.269-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cookies'/><category scheme='http://www.blogger.com/atom/ns#' term='detect'/><title type='text'>Simple Cookie Detect</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;All PUT, UPDATE and DESTROY methods require the session cookie with protect_from_forgery or the  application will break if a browser has cookies turned off when one of these methods are used.&lt;br /&gt;&lt;br /&gt;Unfortunately, when a browser calls the application for the first time, the session cookie wil be written, but it wont be read untill the next page request. This makes it impossible to know if cookies are off, or of in the browser so anyone visiting the application first time and lets say, posts a form will be disapointed.&lt;br /&gt;&lt;br /&gt;This is a simple solution to the problem. All controllers will call a cookies_required method when PUT, UPDATE or DESTROY methods are used. The cookies_required method looks to see it if the session cookie is empty - if it is, it will catch the http-referrer and redirect to the method check_for_cookies - if the session cookie is still empty, then we can be certain that cookies are off in the browser and refrain the user from using the &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;PUT, UPDATE or DESTROY methods. Instead we show a message about cookies being off and the application having limited functionality untill they are turned on.  &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;Add the following to application.rb &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;..before_filter :cookies_required, :except =&gt; [:show, :check_for_cookies]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;..def check_for_cookies&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;....if request.cookies["_cookie_detect_session"].to_s.blank?  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;......render :text =&gt; 'You absolutly Need Cookies on to use this function'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;....else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;......redirect_back_or_default(:controller =&gt; 'home')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;....end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;..end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;protected&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;..def cookies_required?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;....return unless request.cookies["_cookie_detect_session"].to_s.blank? &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;....session[:return_to] = request.request_uri&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;....redirect_to(:controller =&gt; 'home',:action =&gt; 'check_for_cookies')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;..end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;..def redirect_back_or_default(default)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;....session[:return_to] ? redirect_to(session[:return_to]) : redirect_to(default)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;....session[:return_to] = nil&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;..end&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-5506092182921554982?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/5506092182921554982/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=5506092182921554982' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/5506092182921554982'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/5506092182921554982'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/10/cookie-detect.html' title='Simple Cookie Detect'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-3361818334809691346</id><published>2008-10-10T10:37:00.000-07:00</published><updated>2008-10-10T10:39:06.430-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='forgery'/><category scheme='http://www.blogger.com/atom/ns#' term='csrf'/><category scheme='http://www.blogger.com/atom/ns#' term='session attack'/><category scheme='http://www.blogger.com/atom/ns#' term='spam'/><title type='text'>Rails Security</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;a style="font-family: verdana;" href="http://www.quarkruby.com/2007/9/20/ruby-on-rails-security-guide#csrf"&gt;Great security guide&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-3361818334809691346?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/3361818334809691346/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=3361818334809691346' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3361818334809691346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3361818334809691346'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/10/rails-security.html' title='Rails Security'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-2145068561514828050</id><published>2008-10-06T05:00:00.000-07:00</published><updated>2008-10-06T06:04:13.071-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='rjs'/><title type='text'>Javascript and RJS</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;To descide how to handle javascript in ruby you should seperate between.&lt;br /&gt;&lt;br /&gt;1. Effects (hide, show, highlight, fade ect), and&lt;br /&gt;2. Interactive data (with or without visual effects)&lt;br /&gt;3. Embedding Javascript the good old way.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;1. Effects&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;Visual effects being anything that just tells the client side javascript engine to do somthing with one or more its DOM's.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;2. Interactive Data&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;Interactive data, would be somthing like a calculating user input and diplaying the resulting sum in realtime.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;3. Embedding Javascript the good old ways&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;If you like cluttering every things up javascript, you probably should not being using rails. Apart from needing a lot more programming time, and lines of code and making everything a millon times more dificult to test there is no reason what so ever to fall back to embedding javascript in the views as it used to be.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;The difference between the 1 and 2 is that in the first case, you don't need to use an RJS file, whereas in the second case you will need and observer and an RJS file to handle the resulting data update when the observer registers user data changes in one or more input fields on a page.&lt;br /&gt;&lt;br /&gt;Rails Javascript Engine.&lt;br /&gt;==============&lt;br /&gt;This engine can only do one thing. Wack out javascript to the client side browsers java engine for rendering. The Rails engine has no concept of the state of the page being manipulated by the client side browser java engine.&lt;br /&gt;&lt;br /&gt;This means conditionals are not directly possible. i.e.&lt;br /&gt;if page[:input_field_name] == 'red'&lt;br /&gt;  page[&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;:input_field_name&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;] = 'blue'&lt;br /&gt;&lt;br /&gt;What you can do is this:&lt;br /&gt;page &lt;&lt; "if $(('input_field_name').value == 'red' {"  # this is a straight javascript string which does not get interpreted page[:input_field_name]=='blue'   # this get turned into a java script statement and sent to the client page &lt;&lt; "}"  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;# this is a straight javascript string which does not get interpreted and finishes the conditional&lt;br /&gt;&lt;br /&gt;Note the conditional has nothing to do with rails - the engine in the browser interprests the code output by page.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-2145068561514828050?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/2145068561514828050/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=2145068561514828050' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/2145068561514828050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/2145068561514828050'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/10/javascript-and-rjs.html' title='Javascript and RJS'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-3015319494012495005</id><published>2008-10-06T04:42:00.000-07:00</published><updated>2008-10-06T07:29:30.039-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='urls'/><category scheme='http://www.blogger.com/atom/ns#' term='routes.rb'/><category scheme='http://www.blogger.com/atom/ns#' term='routes'/><category scheme='http://www.blogger.com/atom/ns#' term='path'/><title type='text'>Renanaming URL routes</title><content type='html'>&lt;span style=";font-family:verdana;font-size:85%;"  &gt;Renaming the URL'S defaults generated with the controllers.&lt;br /&gt;&lt;br /&gt;i.e you have a resource you address in your code:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;% link_to("award", certificate_path(1)%&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This might be because you actually only have one certificate. You have the link on the page showing Awards, but when the user clicks on the link the URL will show:&lt;br /&gt;&lt;br /&gt;/certificates/show/1&lt;br /&gt;&lt;br /&gt;To change this you need to edit the routes.rb&lt;br /&gt;&lt;br /&gt;&lt;code&gt;map.resources :certificates&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;to the following:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;map.the_certificate 'award', :controller =&gt; certificates, :action =&gt; 'show', id =&gt; 1&lt;br /&gt;map.resources :certificates&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;Now you can change:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;% link_to("award", certificate_path(1)%&gt; to &lt;% link_to("award", the_certificate_path %&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;NOTE 1:&lt;br /&gt;&lt;br /&gt;doing this does not work properly:&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;&lt;code&gt;&lt;br /&gt;map.certificate 'award', :controller =&gt; certificates, :action =&gt; 'show', id =&gt; 1&lt;br /&gt;map.resources :certificates&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;i.e. trying to overwrite mapped resource with the same name to point to the proxy url.&lt;br /&gt;It messes up when you render a form with somthing like&lt;br /&gt;&lt;% form for @certificate %&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;NOTE:&lt;br /&gt;&lt;br /&gt;Whenever you make any changes to the routes.rb file you will need to restart your server!!!!&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-3015319494012495005?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/3015319494012495005/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=3015319494012495005' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3015319494012495005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3015319494012495005'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/10/renanaming-url-routes.html' title='Renanaming URL routes'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-2623039466933092839</id><published>2008-10-06T03:10:00.000-07:00</published><updated>2008-10-06T03:42:36.043-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='YML'/><category scheme='http://www.blogger.com/atom/ns#' term='migrate'/><category scheme='http://www.blogger.com/atom/ns#' term='load'/><category scheme='http://www.blogger.com/atom/ns#' term='rake'/><category scheme='http://www.blogger.com/atom/ns#' term='table'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>Loading Tables with Defauls Application Data in Migrations</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;1. Rake a migration to make the table&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;2. Make a new directory 'development_data' in app/db/migrate/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;3. Make a YML file with the "tablename.yml" (check pural!) containing the default data for the table you need for the application (don't mix wiht test data)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;&lt;/span&gt;&lt;span style="font-family: verdana;"&gt;4. Run rake db:migrate to create the tables and load them with the default data from the YML&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;==== Table Create Migration example&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;&gt; ruby script/generate migration Certificates title:string description:text  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;==== YML example&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;certificate:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;..id: 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;..title: "All About This Certificate"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;..description: "Blah Blah."&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;..id: 2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;..title: "All About This Certificate"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;..description: "More Blah Blah."&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;==== Create Load Migration example&lt;/span&gt;&lt;br /&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;&gt; ruby script/generate migration Certificates title:string description:text  &lt;/span&gt;&lt;br /&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;==== Load Data example&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;&lt;code&gt;&lt;br /&gt;class LoadCertificatesData &lt;&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;..def self.up&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;....down&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;....directory=File.join(File.dirname(__FILE__),"development_data")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;....Fixtures.create_fixtures(directory,"certificates")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;..end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;..def self.down&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;....Certificate.delete(:all)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;..end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;==== Load Data example&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;This strategy might fail over time if you are adding and deleting existing colums in migrations, so you might have to end up doing all your load migrations after all the structural migrations have finished. &lt;/span&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;However, this might fail to if table relations ships are complex - so then you might have to fall back to an administration interface in the application where you build the tables from the YML file with your own programming. &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-2623039466933092839?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/2623039466933092839/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=2623039466933092839' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/2623039466933092839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/2623039466933092839'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/10/loading-tables-with-defauls-application.html' title='Loading Tables with Defauls Application Data in Migrations'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-4256208415608436400</id><published>2008-09-30T06:14:00.000-07:00</published><updated>2008-10-13T22:40:39.595-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cookies'/><category scheme='http://www.blogger.com/atom/ns#' term='sessions'/><title type='text'>Sessions and, or Cookies</title><content type='html'>&lt;span style=";font-family:verdana;font-size:85%;"  &gt;Rails 2.0 + uses a cookie on the client bowser to store session data. Sesion data is used to protect against misuse and data theft.&lt;br /&gt;&lt;br /&gt;If the client browser has cookies disabled the application with throw an exception for any and all PUT, UPDATE and DESTROY requests.&lt;br /&gt;&lt;br /&gt;To safeguard this you should diable any code that results in &lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;PUT, UPDATE and DESTROY&lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt; requests if cookies are disabled in the browser client.&lt;br /&gt;&lt;br /&gt;Just add a protected method in the application controller.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;helper_method :cookies_on?&lt;br /&gt;protected&lt;br /&gt;&lt;br /&gt;def cookies_on?&lt;br /&gt;..request.cookies["_appname_session"].to_s.include?('_appname_session')&lt;br /&gt;end     &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The "_appname_session" defalts to the name for your application and is defined in the app/config/environment.rb&lt;br /&gt;&lt;br /&gt;&lt;code&gt;config.action_controller.session = {&lt;br /&gt;  :session_key =&gt; '_appname_session',&lt;br /&gt;  :secret      =&gt; 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In your controllers and views you can now write:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;% if cookies_on? %&gt;&lt;br /&gt;  &lt;!-- here the code that shows a form sumbit button, for example --&gt;   # show the form with the submit button&lt;br /&gt;&lt;% else %&gt;&lt;br /&gt;  &lt;!-- maybe you show a text that tell the user that they cannot use theh form because they have ther cookies deactivated in their browser --&gt;   # show the form without the submit button and display a message telling the user that this site protects the identiy of users with coded cookies and they cannot sumbit the form without cookies enabled in the browser.&lt;br /&gt;&lt;% end %&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;As the session cookie won't be avilable until the user has loaded at least two pages of your application, until then your application will be in a state of "cookies disabled".&lt;br /&gt;&lt;br /&gt;This is all a bit of a pain, especially in the light of mobile browsers, most of which do not support cookies. However in the light of data protection, there is a real need to come up with practices to deal with this. And rails does a great job - so lets not get pissed off with rails, but more with the twits that seem to think the web is some sort of data free for all.&lt;br /&gt;&lt;br /&gt;BTW: Setting your own cookie is as easy as&lt;br /&gt;cookies [:my_name_of_cookie]="hello this string will now be in a cookie in the users browser"&lt;br /&gt;&lt;br /&gt;The next time the user views somthing you can read the cookie:&lt;br /&gt;value=cookies[:my_name_of_cookie]&lt;br /&gt;puts value -&gt; &lt;/span&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;"hello this string will now be in a cookie in the users browser"&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;&lt;br /&gt;&lt;span style="font-family:monospace;"&gt;&lt;/span&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-4256208415608436400?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/4256208415608436400/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=4256208415608436400' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/4256208415608436400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/4256208415608436400'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/09/sessions.html' title='Sessions and, or Cookies'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-1614957110879838110</id><published>2008-09-30T00:01:00.000-07:00</published><updated>2008-09-30T00:43:28.203-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='remove_table'/><category scheme='http://www.blogger.com/atom/ns#' term='add_table'/><category scheme='http://www.blogger.com/atom/ns#' term='migrate'/><category scheme='http://www.blogger.com/atom/ns#' term='add_primary_key'/><category scheme='http://www.blogger.com/atom/ns#' term='rename_column'/><category scheme='http://www.blogger.com/atom/ns#' term='add_index'/><category scheme='http://www.blogger.com/atom/ns#' term='rake'/><category scheme='http://www.blogger.com/atom/ns#' term='add_column'/><title type='text'>Rake migrations effecting exisitng tables</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold;font-family:verdana;" &gt;Things that can done:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;Adding a new table, Removing a table, Adding a column to an existing table, Removing a column, Renaming a column, Renaming a table, Adding an index, Adding a primary key.&lt;br /&gt;&lt;br /&gt;&gt;ruby script/generate migrtion add_price&lt;br /&gt;&lt;br /&gt;This creates a new migration file in db/migrations&lt;br /&gt;&lt;code&gt;&lt;br /&gt;class AddPrice&lt;br /&gt;...def self.up&lt;br /&gt;.....add_column :products, :price, decimal, :precision =&gt; 8, :scale =&gt; 2, :default =&gt; 0&lt;br /&gt;...end&lt;br /&gt;&lt;br /&gt;...def self.down&lt;br /&gt;  ......remove_column :products, :price&lt;br /&gt;...end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-1614957110879838110?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/1614957110879838110/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=1614957110879838110' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/1614957110879838110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/1614957110879838110'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/09/rake-migrations-effecting-exisitng.html' title='Rake migrations effecting exisitng tables'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-3211486116167650734</id><published>2008-09-20T10:34:00.001-07:00</published><updated>2008-09-20T10:38:53.967-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='error_messages_on'/><category scheme='http://www.blogger.com/atom/ns#' term='gotcha'/><title type='text'>error_messages_on</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;BIG GOTCHA!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;1. don't use redirect_to in the controller otherwise the view wont get, i.e. display the error message. user ender instead. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;2. error_messages_on wants the name of the instance variable used in the controller, ie if you use, &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;error_messages_on 'instance_variable'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;then make sure you use&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;@instance_variable in your controller code. Its this vairable that has the method @instance_vaiable.errors which error_on_messages uses.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-3211486116167650734?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/3211486116167650734/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=3211486116167650734' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3211486116167650734'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3211486116167650734'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/09/eoor.html' title='error_messages_on'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-643168963298747654</id><published>2008-09-19T00:52:00.000-07:00</published><updated>2008-09-19T04:32:26.544-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='deploy'/><category scheme='http://www.blogger.com/atom/ns#' term='RAILS_ENV'/><category scheme='http://www.blogger.com/atom/ns#' term='ssh-keygen'/><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='spin'/><category scheme='http://www.blogger.com/atom/ns#' term='freeze'/><category scheme='http://www.blogger.com/atom/ns#' term='ssh'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.1'/><category scheme='http://www.blogger.com/atom/ns#' term='capistrano'/><title type='text'>Capistrano Deployment.</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;Capistrano gets the latest version of the application from a given reposity and puts it online under a specific web domain.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Install Capistrano&lt;/span&gt;&lt;br /&gt;1. install gem &gt;gem install capistrano&lt;br /&gt;2. check that worked out &gt;cap -h&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Setup app for Capistrano&lt;/span&gt;&lt;br /&gt;1. in root directory of the application&gt;capify&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Configure Capistrano&lt;/span&gt;&lt;br /&gt;(don't use cap deploy:cold - which is suposed to workout the configuration - you have to do the following once)&lt;br /&gt;1. in app/config - edit the deploy.rb file&lt;br /&gt;&lt;br /&gt;set :application, "nameofapp"&lt;br /&gt;&lt;span style="font-size:78%;"&gt;#Note: This will also be the name of the directory created for the app files&lt;br /&gt;&lt;/span&gt;set :repository, "git@git.whateverthedomainis:whateverthenameis.git&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;#Note: This is the location of the repository of the application&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;set :deploy_to, "/full/path/from/server/root/directory/to/app/directory/on/server/#{application}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;#Note: This is absolute location on the server where the application root directoy will be placed after being fetched from the repository&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;set :scm, :git&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;#Note: This is the resposity type (in this case a git)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;set :scm_user, "name"&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;#Note: This is the user_name that is needed to access the repository. note: the need for a password is normally replaced by a ssh public key&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;set :user, "name"&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;#Note: This is the ssh username for the domain i.e. &gt;ssh username@yourdomain.com&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;set :use_sudo, false&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;#Note: Capistrano will want to make some directorys on the server, it this is set to true it will use sudo before making them. I suggest to keep this false - capistrano does not need it and less things can go wrong, especially the first time.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;set :branch, "whateverbranch"&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;#Note: The deal here is that after capistrano has cloned the repository on the server is will checkout this branch. I could not get this to work - and so expect the last version of the master branch to be checked out (at least with git and v2.5 of capistrano)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;role :app, "yourdomain" # i.e. www.whatever.com&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;#Note: This is the address of the server that hosts the application server (i.e. mongrel, mod_rails etc)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;role :web, "yourdomain" # i.e. www.whatever.com&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;#Note: This is the address of the server that hosts the webserver server (i.e. apache, etc)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;role :db, "yourdomain" , :primary =&gt; true # i.e. www.whatever.com&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;#Note: This is the address of the server that hosts the database (i.e. mysql, postresql)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;#Note: The :primary tells capistrano which server to run any migrations against.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Setup publickey of your server to access the application repository. &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;1. Login to server with a ssh shell session (i.e. &gt;ssh name@dominnameofserver (i.e. ssh me@happy.com)) - If you are not working with public keys, then you should be asked for the password to access - after entering it you should be it.&lt;br /&gt;&lt;br /&gt;2. cd to home on the server &gt;cd&lt;br /&gt;&lt;br /&gt;3. cd to the .ssh directory &gt; cd .ssh&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;#Note: check for a file id_rsa.pub if its not there, then run ssh-keygen (just enter return at prompts)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;3. enter on command line &gt;more id_rsa.pub&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;4. Copy the key and add it to your existing repository key&lt;br /&gt;&lt;span style="font-size:78%;"&gt;Note: github.com and assembla.com have a web interface for your to do that if your repository is hosted there.&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;5. Check that that works by cloning the application repository by hand on the server&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Freeze Rails. &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&gt;rake rails:freeze:gems&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href="http://209.85.135.104/search?q=cache:eps1VTQSErQJ:www.akitaonrails.com/2008/5/25/rolling-with-rails-2-1-the-first-full-tutorial-part-1+freeze+rails+2.1&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;cd=1"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Vendorize gems #TODO.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;If you are using gems but cannot install them on a sharehost then you have the option to vendorize them.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&gt;rake gems:install&lt;br /&gt;&gt;rake gems:unpack:dependencies&lt;br /&gt;&gt;rake gems:build&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Make Spin Script. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;This is a small script in app/script/ called spin.rb&lt;br /&gt;This script is called by capistrano after the app has been deployed to start the app and web server&lt;br /&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;#{deploy_to}/current/script/process/spawner \&lt;br /&gt;  mongrel \&lt;br /&gt;  --environment=production \&lt;br /&gt;  --instances=1 \&lt;br /&gt;  --address=127.0.0.1 \&lt;br /&gt;  --port=#{port}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;(#TODO Check the above)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Update Git repository. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;git add .&lt;br /&gt;git commit -m 'ready to deploy'&lt;br /&gt;git push origin master&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Deploy Setup. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;git add .&lt;br /&gt;git commit -m 'ready to deploy'&lt;br /&gt;git push origin master&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;cap deploy:setup&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Check Dependencies. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;cap deploy:check&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Deploy the Update. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;cap deploy:update&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Server stuff. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;open a shh session on the server&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&gt;shh name@domin.xx&lt;br /&gt;&gt;cd to your app root directy&lt;br /&gt;&gt;rake RAILS_ENV=production db:schema:load&lt;br /&gt;&lt;span style="font-size:78%;"&gt;note: If this does not work - then obviously you will have to find out why and fix it before continuing.&lt;br /&gt;&lt;/span&gt;&gt;script/console production&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;note: The production environment should load up without any errors.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&gt;&gt;app.get("/")&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;note: This should return a status code of 200, 302 or similar.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Deploy Start. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;On the local machine:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&gt;cap deploy:start&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;note: This should return a status code of 200, 302 or similar.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Now everthing should have fired up and be working. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-643168963298747654?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/643168963298747654/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=643168963298747654' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/643168963298747654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/643168963298747654'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/09/capistrano-deployment.html' title='Capistrano Deployment.'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-2351234611087567838</id><published>2008-09-02T13:08:00.000-07:00</published><updated>2008-09-05T08:34:57.406-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rspec'/><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='autotest'/><category scheme='http://www.blogger.com/atom/ns#' term='developing'/><title type='text'>Developing Rails Plugins with RSpec</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;To use RSpec while developing plugins install this rspec generator plugin as follows.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Install RSpec Plugin&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;script/plugin install git://github.com/pat-maddox/rspec-plugin-generator.git&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Create Plugin Framework&lt;/span&gt;&lt;br /&gt;script/generate rspec_plugin new_fu&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Setup Autotesting&lt;/span&gt;&lt;br /&gt;create a file: discover.rb to vendor/plugins/new_fu/lib/autotest/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;insert the following at the top of the discover.rb file:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;  $:.push(File.join(File.dirname(__FILE__), %w[.. .. rspec]))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;  Autotest.add_discovery do&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;    rspec&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;  end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;create a spec.opts file in the plugin/new_fu/spec folder and add the following:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;--colour&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;--format progress&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;--loadby mtime&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;--reverse&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;&lt;span style="font-family:verdana;"&gt;Set Plugin Location&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;This avoids naming conflicts with other plugins.&lt;br /&gt;create a directory structure within nuw_fu/lib somthing like this.&lt;br /&gt;your_name/name_or_your_company&lt;br /&gt;&lt;br /&gt;Now move the new_fu.rb file into the directory name_of_your_company.&lt;br /&gt;&lt;br /&gt;Your new_fu.rb file should now be in&lt;br /&gt;app/vendors/plugins/new_fu/your_name/name_of_your_company/new_fu.rb&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Start Autotest for Apllication&lt;/span&gt;&lt;br /&gt;Open a terminal window and go to the root of your apllication&lt;br /&gt;first type: rake spec&lt;br /&gt;It should run through and sync the app with your rspec environment&lt;br /&gt;Then type: autotest&lt;br /&gt;The autostest should start and re-run everytime you change a file in your application&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Set test environment&lt;/span&gt;&lt;br /&gt;open a terminal window - locate the base of your app and type:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: verdana;"&gt;export RAILS_ENV=test &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Start Autotest for Plugin&lt;/span&gt;&lt;br /&gt;Open a terminal window and go to the root of your plugin directory&lt;br /&gt;app/vendor/plugins/new_fu/&lt;br /&gt;and type in autotest&lt;br /&gt;The autostest should start and re-run everytime you change a file in your plugin&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Set up Plugin init.rb file. &lt;/span&gt;&lt;br /&gt;Locate the init.rb file in vendor/plugins/new_fu&lt;br /&gt;add: include 'your_name/name_of_your_company/new_fu'&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Set up Plugin as a module &lt;/span&gt;&lt;br /&gt;Open your plugin file&lt;br /&gt;vendor/plugins/new_fu/your_name/name_of_your_company/new_fu.rb&lt;br /&gt;add the following.&lt;br /&gt;&lt;br /&gt;.module YourName&lt;br /&gt;....module NameOfYourCompany&lt;br /&gt;.......module NewFu&lt;br /&gt;.&lt;br /&gt;...........def hello_world&lt;br /&gt;..............puts "Hello World"&lt;br /&gt;...........end&lt;br /&gt;.&lt;br /&gt;......end&lt;br /&gt;...end&lt;br /&gt;.end&lt;br /&gt;&lt;br /&gt;Then in the new_fu_spec.rb file - located in vendor/plugins/new_fu/spec/ - add the following:&lt;br /&gt;&lt;br /&gt;.require File.dirname(__FILE__) + '/spec_helper'&lt;br /&gt;.&lt;br /&gt;.describe YourName::NameOfYourCompany::NewFu, "" do&lt;br /&gt;......include YourName::NameOfYourCompany::NewFu&lt;br /&gt;.&lt;br /&gt;......before do&lt;br /&gt;......end&lt;br /&gt;.&lt;br /&gt;......it "should should say hello world" do&lt;br /&gt;........hello_world&lt;br /&gt;.....end&lt;br /&gt;.&lt;br /&gt;.end&lt;br /&gt;&lt;br /&gt;The autotest should have passed on the tests and you should see "hello world" somewhere in the output.&lt;br /&gt;&lt;br /&gt;######## To Be Continued.....&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Further documentation.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;Understanding and building plugins - &lt;a href="http://vimeo.com/1412708"&gt;Part I&lt;/a&gt;&lt;br /&gt;Understanding and building plugins - &lt;a href="http://vimeo.com/1413035"&gt;Part II&lt;/a&gt;&lt;br /&gt;Creating Plugins &lt;a href="http://izumi.plan99.net/manuals/creating_plugins.html"&gt;Manual&lt;/a&gt;&lt;br /&gt;&lt;a href="http://izumi.plan99.net/manuals/creating_plugins.html"&gt;Autotesting while writing Rails Plugins&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-2351234611087567838?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/2351234611087567838/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=2351234611087567838' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/2351234611087567838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/2351234611087567838'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/09/developing-rails-plugins-with-rspec.html' title='Developing Rails Plugins with RSpec'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-7832452637550234679</id><published>2008-09-01T07:45:00.000-07:00</published><updated>2008-09-01T07:58:47.501-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='spec_helper.rb'/><category scheme='http://www.blogger.com/atom/ns#' term='spec'/><category scheme='http://www.blogger.com/atom/ns#' term='except'/><category scheme='http://www.blogger.com/atom/ns#' term='only'/><category scheme='http://www.blogger.com/atom/ns#' term='with'/><title type='text'>Rspec Helper Extention</title><content type='html'>&lt;span style=";font-family:verdana;font-size:85%;"  &gt;Additional Helper Methods (except, with, only) in spec_helper.rb file in project_folder/spec/&lt;br /&gt;&lt;br /&gt;class Hash&lt;br /&gt;&lt;br /&gt; # filter key out of a hash&lt;br /&gt; # {:a=&gt;1, :b=&gt; 2, :c=&gt; 3}.except(:a)&lt;br /&gt; # results of hash after call {:b=&gt; 2, :c=&gt; 3 }&lt;br /&gt;&lt;br /&gt; def except(*keys)&lt;br /&gt;   self.reject { |k,v| keys.include?(k || k.to_sym) }&lt;br /&gt; end&lt;br /&gt;&lt;br /&gt; # override some keys with a new value&lt;br /&gt; # {:a=&gt;1, :b=&gt; 2, :c=&gt; 3}.with(:a =&gt; 4)&lt;br /&gt; # results of hash after call {:a =&gt; 4, :b=&gt; 2, c: =&gt; 3 }&lt;br /&gt; def with(overrides = {})&lt;br /&gt;   self.merge overrides&lt;br /&gt; end&lt;br /&gt;&lt;br /&gt; # return a hash with only the pairs identified by the +keys+&lt;br /&gt; # { :a=&gt;1, :b=&gt;2, :c=&gt;3}.only(:a)&lt;br /&gt; # results of hash after call {:a=&gt;1}&lt;br /&gt; def only(*keys)&lt;br /&gt;   self.reject { |k,v| !keys.include?(k || k.to_sym ) }&lt;br /&gt; end&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-7832452637550234679?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/7832452637550234679/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=7832452637550234679' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7832452637550234679'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7832452637550234679'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/09/rspec-helper-extention.html' title='Rspec Helper Extention'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-2587264044394144110</id><published>2008-08-30T11:27:00.000-07:00</published><updated>2008-08-30T11:29:31.386-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='setup'/><category scheme='http://www.blogger.com/atom/ns#' term='environment'/><title type='text'>Setting the Test, Production, Development Environment</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: verdana;"&gt;&gt;export RAILS_ENV=test    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;&gt;export RAILS_ENV=development&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;&gt;export RAILS_ENV=production&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-2587264044394144110?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/2587264044394144110/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=2587264044394144110' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/2587264044394144110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/2587264044394144110'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/08/setting-test-production-development.html' title='Setting the Test, Production, Development Environment'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-3865147023211442213</id><published>2008-08-30T10:11:00.000-07:00</published><updated>2008-09-01T07:59:16.750-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rspec'/><category scheme='http://www.blogger.com/atom/ns#' term='rake'/><category scheme='http://www.blogger.com/atom/ns#' term='environment'/><category scheme='http://www.blogger.com/atom/ns#' term='cheatsheet'/><title type='text'>RSpec CheatSheet</title><content type='html'>&lt;a style="font-family: verdana;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://techblog.daveastels.com/2006/09/09/rspec-cheat-sheet/"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://4.bp.blogspot.com/_CeoEjIx6WGA/SLmBJxcFf_I/AAAAAAAAAAM/B13ozXkhPtw/s320/rspec+cheatsheet.jpg" alt="" id="BLOGGER_PHOTO_ID_5240361646312226802" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;&gt;rake -T spec (output of the available rake tasks for rspec)&lt;br /&gt;&gt;ruby script/spec -h (output availble plugin rspec options)&lt;br /&gt;&gt;ruby script/generate (shows the rspec generators that replace the normal rails generators)&lt;br /&gt;(i.e. ruby script/generate rspec_scaffold will show the available options)&lt;br /&gt;&gt;rake doc:plugins (generate the rspec documentation in doc/plugins/rspec-rails/index.html)&lt;br /&gt;&gt;rake spec (sync the development environement with the test environment before running autotest)&lt;br /&gt;&gt;autotest (starts the background testing)&lt;br /&gt;&lt;br /&gt;IMPORTANT: Set the test rspec it set up to work in the test environment, &lt;a href="http://jasonsrailsblog.blogspot.com/2008/08/setting-test-production-development.html"&gt;so make sure it has been set&lt;/a&gt;&lt;br /&gt;Also see extention spec helper methods &lt;a href="http://jasonsrailsblog.blogspot.com/2008/09/rspec-helper-extention.html"&gt;post&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-3865147023211442213?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/3865147023211442213/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=3865147023211442213' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3865147023211442213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3865147023211442213'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/08/rspec-cheatsheet.html' title='RSpec CheatSheet'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_CeoEjIx6WGA/SLmBJxcFf_I/AAAAAAAAAAM/B13ozXkhPtw/s72-c/rspec+cheatsheet.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-3039314461198119656</id><published>2008-08-30T06:35:00.000-07:00</published><updated>2008-08-30T10:30:43.781-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='cheatsheet'/><title type='text'>Git CheatSheet</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;a style="font-family: verdana;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://git.or.cz/gitwiki/GitCheatSheet"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px;" src="http://ktown.kde.org/%7Ezrusin/git/git-cheat-sheet-large.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;.gitignore contains the ignore files (add *.log, .DS_Store, config/database.yml)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git init&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git add .&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git add "file name"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git status&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git --global user.name "name"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git --global user.email "email"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git --global apply.whitespace nowarn&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git commit -m "message describing this commit" or git commit -v (shows you the diffs done and lets you write your commit mesage)&lt;br /&gt;&gt;git commit -a (commit all files that have been changed)&lt;br /&gt;&gt;git commit -a -v (commit all files and show diffs that have been changed)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&gt;git log (give ascii log with messages)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git log --stat (ascii output graph of the file changes with + and -)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git log --p (see the diffs of the files)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;gitk (launch a visual tool of the git log). &gt;gitk &amp;amp; to run in the background&lt;br /&gt;&gt;gitk -all (all local and remote branches)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git branch (show the current branches)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git branch --color (shows local and remote branches in color)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git branch "name of branch" (creates a new branch)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git branch -a (shows all local and remote branches)&lt;br /&gt;&gt;git checkout "name of branch" (to work on the named branch)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git rebase "name of another branch" (get current changes from another branch into my working branch)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git diff "branch 1" "branch2" (show the diffs of 2 branches) or pipe to TextMate with git diff "branch1" "branch2" | mate&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&gt;git merge branch (merges branch into current branch)&lt;br /&gt;&gt;git reset --hard ORIG_HEAD (revert the merge)&lt;br /&gt;&gt;git stash "message" (save current status of work to a "clipboard")&lt;br /&gt;&gt;git stash list (show the contents of the clipboard)&lt;br /&gt;&gt;git stash apply (bring the status in the clipboard)&lt;br /&gt;&gt;git branch -d branchname (delete a previously merged branch)&lt;br /&gt;&gt;git branch -D branchname (delete a non merged branch)&lt;br /&gt;&gt;git stash clear (clearsout the stach clipboard)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Repositories&lt;/span&gt;&lt;br /&gt;copy project to another machine (cp -r or scp -r)&lt;br /&gt;&gt;git clone remotemachineurl (gets a copy of the remote repository from the remote machine)&lt;br /&gt;&gt;git fetch (get a copy of all objects from the remote machine - don't merge with local machine)&lt;br /&gt;&gt;git pull (syncronizes fetches changes from the remote machine with the local machine with the branch I am currently in)&lt;br /&gt;&gt;git push  (syncronize local changes back to the remote machine)&lt;br /&gt;&gt;git merge (local merging of 2 branches)&lt;br /&gt;&gt;git remote show name_of_repository (shows some info on the branches in the remote repository)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-3039314461198119656?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/3039314461198119656/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=3039314461198119656' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3039314461198119656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3039314461198119656'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/08/git-cheatsheet.html' title='Git CheatSheet'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-3153102425489986767</id><published>2008-08-30T05:40:00.000-07:00</published><updated>2008-09-03T06:29:37.376-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rspec'/><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='setup'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.0.2'/><title type='text'>Setup New Rails Project</title><content type='html'>&lt;div  style="font-family:verdana;"&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Create a new project with: &gt;rails name_of_project, then: &gt;cd name_of_project&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Optionally if using other database than Sqlite: &gt; rake db:create:all&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Install RSpec Plugin &amp;amp; Framework. &lt;a href="http://github.com/dchelimsky/rspec-rails/wikis/home"&gt;Refer to the latest instructions&lt;/a&gt;. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Run the RSpec generator to create framework: &gt;ruby script/generate rspec&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Create latest plugin documents on local drive with: rake doc:plugins. Location of documentation is "name_of_project/doc/plugins/respec-rails/index.html. Open directly in browser with: open -a Firefox doc/plugins/rspec_on_rails/index.html. Or open index.html&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Install and run RSpec &lt;a href="http://jasonsrailsblog.blogspot.com/2008/09/developing-rails-plugins-with-rspec.html"&gt;plugin framework&lt;/a&gt; if needed&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Create the git repository with a cd to the "name_of_project" directory and then: &lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;          &gt;git config --global user.name "your name"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;          &gt;git config --global user.email "your mail@provider"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;          &gt;git config --global apply.whitespace nowarn&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;         to check the settings see .gitconfig or: &gt;git config --list&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;         &gt;git init     (creates local repository and the .git directory)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;         create a .gitignore file and add file to ignore &lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;         *.log&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;         database.yml&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;         db/schema.*&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;         .DS_Store&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;        &gt;git add .    (add all file and contents to firstime checkin)&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;        &gt;git commit -m "first commit"&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;        &gt;git status (check the repos)&lt;br /&gt;&lt;br /&gt;see &lt;a href="http://git.or.cz/gitwiki/GitCheatSheet"&gt;git cheatsheet&lt;/a&gt; for more&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-3153102425489986767?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/3153102425489986767/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=3153102425489986767' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3153102425489986767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3153102425489986767'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/08/setup-new-rails-project.html' title='Setup New Rails Project'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-8768574747141352578</id><published>2008-08-30T04:19:00.000-07:00</published><updated>2008-08-30T06:35:26.227-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rspec'/><category scheme='http://www.blogger.com/atom/ns#' term='macports'/><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.1'/><category scheme='http://www.blogger.com/atom/ns#' term='mac'/><category scheme='http://www.blogger.com/atom/ns#' term='textmate'/><category scheme='http://www.blogger.com/atom/ns#' term='setup'/><category scheme='http://www.blogger.com/atom/ns#' term='leopard 10.5'/><title type='text'>Setup Rails 2.1 on Mac Leopard</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;A version of rails and gem is already installed on the mac so we will update and expand on this installation as follows&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span" style=";font-family:verdana;font-size:85%;"  &gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"&gt;Get and Install &lt;/span&gt;&lt;/span&gt;&lt;a href="http://macromates.com/"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"&gt;TextMate&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style=";font-family:verdana;font-size:85%;"  &gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"&gt;Get and Download &lt;/span&gt;&lt;/span&gt;&lt;a href="http://www.macports.org/install.php"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"&gt;MacPorts&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"&gt; - Leopard (universal). After the download and installation, edit or add to .bash_profile file the following:&lt;/span&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"&gt; export PATH="/opt/local/bin:/opt/local/sbin:$PATH" (see here for more &lt;/span&gt;&lt;/span&gt;&lt;a href="http://209.85.129.104/search?q=cache:1q1SrVOikmIJ:www.buildingwebapps.com/articles/6433-setting-up-rails-on-leopard-mac+rake+create+mac+10.5&amp;amp;hl=de&amp;amp;ct=clnk&amp;amp;cd=6&amp;amp;gl=de"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"&gt;details&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"&gt;) &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style=";font-family:verdana;font-size:85%;"  &gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"&gt;Update macports from the command line terminal with: &gt;sudo port selfupdate. &lt;/span&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"&gt;NOTE: I had a problem with awk not being found during the installation. This was &lt;/span&gt;&lt;/span&gt;&lt;a href="http://209.85.135.104/search?q=cache:cdGxkvgtju4J:www.nabble.com/soft-problem-with-awk-td15296232.html+port+install+no+awk&amp;amp;hl=de&amp;amp;ct=clnk&amp;amp;cd=1&amp;amp;gl=de"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"&gt;solved&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"&gt; by running the installation again. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style=";font-family:verdana;font-size:85%;"  &gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"&gt;Install Git and Svn integration as follows: &gt;sudo port install git-core +doc +svn&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style=";font-family:verdana;font-size:85%;"  &gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"&gt;Update gems with: &gt;sudo gem update&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style=";font-family:verdana;font-size:85%;"  &gt;Install Rspec gem with: &gt; sudo gem install rspec&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style=";font-family:verdana;font-size:85%;"  &gt;Install Zentest with: &gt;sudi gem install ZenTest. You don't need to install the gem if you are only using rails. Zentest enables autotesting in the background.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style=";font-family:verdana;font-size:85%;"  &gt;Install Rspec &lt;a href="http://github.com/dchelimsky/rspec-tmbundle/wikis"&gt;TextMate bundle&lt;/a&gt; specifically for rails supporting development: cd to the TextMate Bundles directory, i.e. &gt; cd ~/Library/Appliction\Support/TextMate/Bundles. Then: &gt; git git clone git://github.com/dchelimsky/rspec-tmbundle.git RSpec.tmbundle&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-8768574747141352578?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/8768574747141352578/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=8768574747141352578' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/8768574747141352578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/8768574747141352578'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/08/setup-rails-21-on-mac-leopard.html' title='Setup Rails 2.1 on Mac Leopard'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-8144140845380834421</id><published>2008-07-12T02:05:00.000-07:00</published><updated>2008-07-12T04:19:52.692-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='composed_of'/><category scheme='http://www.blogger.com/atom/ns#' term='value object'/><category scheme='http://www.blogger.com/atom/ns#' term='aggregate'/><title type='text'>composed_of</title><content type='html'>class CurrencyRate &lt; ActiveRecord::Base&lt;br /&gt;  composed_of :country_rate,  :mapping =&gt; [%w(rate c_rate) , %w(currency c_currency)]&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;composed_of :value_object_name, :mapping =&gt;&lt;br /&gt;[%w(db_column_name_1 @instance_var_name_1) &lt;/span&gt;&lt;span style="font-size:78%;"&gt;%w(db_column_name_2 @instance_var_name_2)&lt;/span&gt;&lt;span style="font-size:78%;"&gt;]&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;important: composed_of gives the class object CurrencyRate 2 new methods,&lt;br /&gt;country_rate and country_rate=&lt;br /&gt;the order of the mapping determines the order  in which  country_rate=  receives its values and how the values will be mapped to the database table.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;class CountryRate                              #this is the value object aggregated by CurrencyRate&lt;br /&gt;       attr_accessor :c_rate, :c_currency&lt;br /&gt;&lt;br /&gt;        def initialize(rate,currency="USD")&lt;br /&gt;        @c_rate, @c_currency=rate,currency&lt;br /&gt;      end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;class CreateCurrencyRates &lt; ActiveRecord::Migration   #This is the table&lt;br /&gt;  def self.up&lt;br /&gt;    create_table :currency_rates do |t|&lt;br /&gt;      t.string :base_currency&lt;br /&gt;      t.string :currency&lt;br /&gt;      t.float :rate&lt;br /&gt;&lt;br /&gt;      t.timestamps&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;  def self.down&lt;br /&gt;    drop_table :currency_rates&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;######### How it is used&lt;br /&gt;&lt;br /&gt;cur=CurrencyRate.new(:base_currency =&gt;"DKK")&lt;br /&gt;cur.country_rate=CountryRate.new(12.4 , "YPN")&lt;br /&gt;cur.save&lt;br /&gt;&lt;br /&gt;######## What happens&lt;br /&gt;&lt;br /&gt;cur=CurrencyRate.find(:first)       # lets find a CurrencyRate object to change&lt;br /&gt;                                                               #  direct access methods have been stripped&lt;br /&gt;cur.rate=123                                       # &lt;- undefined method&lt;br /&gt;cur.country_rate.rate=123              # &lt;- no method error&lt;br /&gt;cur.country_rate.c_rate=123          # &lt;- can' modify frozen object&lt;br /&gt;&lt;br /&gt;####The correct way to access is as follows&lt;br /&gt;&lt;br /&gt;cur.base_currency="YPN"&lt;br /&gt;cur.country_rate=CountryRate.new(345,"PLN") &lt;br /&gt;cur.save                                                # now the&lt;br /&gt;&lt;br /&gt;#####before, the database looks like this&lt;br /&gt;&lt;br /&gt;id                    base_currency                 rate                        currency&lt;br /&gt;1                      DKK                                  12.4                       YPN&lt;br /&gt;&lt;br /&gt;####after, it looks like this&lt;br /&gt;&lt;br /&gt;id                   base_currency                rate                         currency&lt;br /&gt;1                     YPN                                  345.0                       PLN&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Just for claritys sake.&lt;br /&gt;&lt;br /&gt;CurrencyRate is a class with one instance var base_currency&lt;br /&gt;CountryRate is a class with  two instance vars  c_rate and c_currency&lt;br /&gt;&lt;br /&gt;with the composed_of method CountryRate has become a value object.&lt;br /&gt;Value Objects: equality is determined by value - (represented by their  value)&lt;br /&gt;Entity Objects: equality is determined by identity - (represented by their primary keys)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-8144140845380834421?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/8144140845380834421/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=8144140845380834421' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/8144140845380834421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/8144140845380834421'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/07/composedof.html' title='composed_of'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-7730751250034376355</id><published>2008-07-10T05:43:00.000-07:00</published><updated>2008-07-10T05:45:17.797-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='composed_of'/><category scheme='http://www.blogger.com/atom/ns#' term='has_many_and_belongs_to'/><category scheme='http://www.blogger.com/atom/ns#' term='has_many'/><category scheme='http://www.blogger.com/atom/ns#' term='belongs_to'/><category scheme='http://www.blogger.com/atom/ns#' term='relationships'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.1'/><category scheme='http://www.blogger.com/atom/ns#' term='model'/><category scheme='http://www.blogger.com/atom/ns#' term='modeling'/><category scheme='http://www.blogger.com/atom/ns#' term='active record base'/><title type='text'>Modeling Rails</title><content type='html'>Modeling Rails.&lt;br /&gt;&lt;br /&gt;Basically, objects can connect to other objects in 3 different ways.&lt;br /&gt;1. By relationship (i.e. person has one favorite book # person belongs_to favorite_book)&lt;br /&gt;2. By inheritance  (i.e. author is a person # class Author &lt; Person&lt;br /&gt;3. By Aggregation  (i.e Invoice contains a list of items(objects) that have been aggrigated from other objects. composed_of :item :model =&gt; "Book"&lt;br /&gt;&lt;br /&gt;When writing in rails model the application first.&lt;br /&gt;&lt;br /&gt;1. map out the objects &amp;amp; their attributes for the application (i.e)&lt;br /&gt;   Customers   : first_name, last_name, address&lt;br /&gt;   Books       : author, title, price, EAN number&lt;br /&gt;   Invoice      : customer, invoice_number, book&lt;br /&gt;&lt;br /&gt;2. then map out the model connections&lt;br /&gt;   Customers (1---------n) Invoices&lt;br /&gt;   Customer  (1---------1) Favorite_book&lt;br /&gt;   Invoice   (1---------.) Books (invoice aggregates and copies the attributes of a book when added to an order).&lt;br /&gt;&lt;br /&gt;3. Then think about how the objects and relationships can be mapped to the database (through active record).&lt;br /&gt;   i.e. which tables have which columns and how the models relate to each other - belongs_to, has_many, has_many_and_belongs_to, composed_of&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-7730751250034376355?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/7730751250034376355/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=7730751250034376355' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7730751250034376355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7730751250034376355'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/07/modeling-rails.html' title='Modeling Rails'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-2500802442237428173</id><published>2008-07-09T02:11:00.002-07:00</published><updated>2008-07-09T06:29:33.298-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.1'/><category scheme='http://www.blogger.com/atom/ns#' term='maping'/><category scheme='http://www.blogger.com/atom/ns#' term='routes'/><title type='text'>Rails Mapping Routes</title><content type='html'>&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;a href="http://sree.cc/2008/04/18/ruby-on-rails-active-record-%e2%80%94-object-relation-mapping-put-on-rails/"&gt;Mapping Routes Examples&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-2500802442237428173?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/2500802442237428173/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=2500802442237428173' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/2500802442237428173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/2500802442237428173'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/07/mapping-object-on-rails_09.html' title='Rails Mapping Routes'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-4349659256150760098</id><published>2008-07-09T02:11:00.001-07:00</published><updated>2008-07-09T06:30:25.589-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.1'/><category scheme='http://www.blogger.com/atom/ns#' term='mapping objects'/><title type='text'>Mapping Objects on Rails</title><content type='html'>&lt;a href="http://sree.cc/2008/04/18/ruby-on-rails-active-record-%e2%80%94-object-relation-mapping-put-on-rails/"&gt;Mapping Objects Examples&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-4349659256150760098?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/4349659256150760098/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=4349659256150760098' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/4349659256150760098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/4349659256150760098'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/07/mapping-object-on-rails.html' title='Mapping Objects on Rails'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-557685401966281126</id><published>2008-07-09T01:28:00.000-07:00</published><updated>2008-07-09T01:31:58.403-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='options'/><category scheme='http://www.blogger.com/atom/ns#' term='model'/><category scheme='http://www.blogger.com/atom/ns#' term='handy methods'/><title type='text'>Model Code Snippets</title><content type='html'>&lt;pre class="code"&gt;def Order &lt; ActiveRecord::Base&lt;br /&gt; has_many :line_items&lt;br /&gt; belongs_to :customer   # there's a column "customer_id" in the db table&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;def LineItem &lt; ActiveRecord::Base&lt;br /&gt; belongs_to :order # there's a column "order_id" in the db table&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;def Customer &lt; ActiveRecord::Base&lt;br /&gt; has_many :orders&lt;br /&gt; has_one :address&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;def Address &lt; ActiveRecord::Base&lt;br /&gt; belongs_to :customer&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;belongs_to  :some_model,&lt;br /&gt;       :class_name  =&gt; 'MyClass',      # specifies other class name&lt;br /&gt;       :foreign_key =&gt; 'my_real_id',   # and primary key&lt;br /&gt;       :conditions  =&gt; 'column = 0'    # only finds when this condition met&lt;br /&gt;&lt;br /&gt;has_one :some_model,&lt;br /&gt;       # as belongs_to and additionally:&lt;br /&gt;       :dependent   =&gt; :destroy        # deletes associated &lt;b style="color: black; background-color: rgb(153, 255, 153);"&gt;object&lt;/b&gt;&lt;br /&gt;       :order       =&gt; 'name ASC'      # SQL fragment for sorting&lt;br /&gt;&lt;br /&gt;has_many :some_model&lt;br /&gt;       # as has_one and additionally:&lt;br /&gt;       :dependent =&gt; :destroy          # deletes all dependent data&lt;br /&gt;                                       # calling each objects destroy&lt;br /&gt;       :dependent =&gt; :delete_all       # deletes all dependent data&lt;br /&gt;                                       # without calling the destroy methods&lt;br /&gt;       :dependent =&gt; :nullify          # set association to null, not&lt;br /&gt;                                       # destroying objects&lt;br /&gt;       :group =&gt; 'name'                # adds GROUP BY fragment&lt;br /&gt;       :finder_sql =&gt; 'select ....'    # instead of the Rails finders&lt;br /&gt;       :counter_sql =&gt; 'select ...'    # instead of the Rails counters&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;validates_presence_of :firstname, :lastname     # must be filled out&lt;br /&gt;&lt;br /&gt;validates_length_of :password,&lt;br /&gt;                   :minimum =&gt; 8           # more than 8 characters&lt;br /&gt;                   :maximum =&gt; 16          # shorter than 16 characters&lt;br /&gt;                   :in =&gt; 8..16            # between 8 and 16 characters&lt;br /&gt;                   :too_short =&gt; 'way too short'   &lt;br /&gt;                   :too_long =&gt; 'way to long'&lt;br /&gt;&lt;br /&gt;validates_acceptance_of :eula               # Must accept a condition&lt;br /&gt;                       :accept =&gt; 'Y'      # default: 1 (ideal for a checkbox)&lt;br /&gt;&lt;br /&gt;validates_confirmation_of :password    &lt;br /&gt;# the fields password and password_confirmation must match&lt;br /&gt;&lt;br /&gt;validates_uniqueness_of :user_name              # user_name has to be unique&lt;br /&gt;                       :scope =&gt; 'account_id'  # Condition:&lt;br /&gt;                                               # account_id = user.account_id&lt;br /&gt;&lt;br /&gt;validates_format_of :email          # field must match a regular expression&lt;br /&gt;                   :with =&gt; /^(+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i&lt;br /&gt;&lt;br /&gt;validates_numericality_of   :&lt;b style="color: black; background-color: rgb(160, 255, 255);"&gt;value&lt;/b&gt;                  # &lt;b style="color: black; background-color: rgb(160, 255, 255);"&gt;value&lt;/b&gt; is numeric&lt;br /&gt;                           :only_integer =&gt; true  &lt;br /&gt;                           :allow_nil =&gt; true     &lt;br /&gt;&lt;br /&gt;validates_inclusion_of  :gender,    # &lt;b style="color: black; background-color: rgb(160, 255, 255);"&gt;value&lt;/b&gt; is in enumeration&lt;br /&gt;                       :in =&gt; %w( m, f )&lt;br /&gt;&lt;br /&gt;validates_exclusion_of  :age            # &lt;b style="color: black; background-color: rgb(160, 255, 255);"&gt;value&lt;/b&gt; is not in Enumeration&lt;br /&gt;                       :in =&gt; 13..19   # don't want any teenagers&lt;br /&gt;&lt;br /&gt;validates_associated :relation &lt;br /&gt;# validates that the associated &lt;b style="color: black; background-color: rgb(153, 255, 153);"&gt;object&lt;/b&gt; is valid&lt;br /&gt;&lt;br /&gt;Options for all validations above:&lt;br /&gt;:message =&gt; 'my own errormessage'   # eigene Fehlermeldung&lt;br /&gt;:on      =&gt; :create                 # or :update (validates only then)&lt;br /&gt;:if      =&gt; ...                     # call method oder Proc&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-557685401966281126?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/557685401966281126/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=557685401966281126' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/557685401966281126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/557685401966281126'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/07/model-code-snippets.html' title='Model Code Snippets'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-4411635532513292440</id><published>2008-07-08T13:20:00.000-07:00</published><updated>2008-07-08T23:40:17.588-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='public instance methods'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.1'/><category scheme='http://www.blogger.com/atom/ns#' term='active record base'/><title type='text'>ActiveRecord::Base</title><content type='html'>These are the public instance methods available for the model classes.&lt;br /&gt;&lt;h1&gt;Model Methods&lt;/h1&gt;&lt;&lt;br /&gt;&lt;=&lt;br /&gt;&lt;=&gt;&lt;br /&gt;==&lt;br /&gt;===&lt;br /&gt;=~&lt;br /&gt;&gt;&lt;br /&gt;&gt;=&lt;br /&gt;__id__&lt;br /&gt;__send__&lt;br /&gt;`&lt;br /&gt;abstract_class&lt;br /&gt;abstract_class=&lt;br /&gt;abstract_class?&lt;br /&gt;accessible_attributes&lt;br /&gt;active_connection_name&lt;br /&gt;active_connections&lt;br /&gt;acts_like?&lt;br /&gt;add_observer&lt;br /&gt;after_create&lt;br /&gt;after_create_callback_chain&lt;br /&gt;after_destroy&lt;br /&gt;after_destroy_callback_chain&lt;br /&gt;after_find&lt;br /&gt;after_find_callback_chain&lt;br /&gt;after_initialize&lt;br /&gt;after_initialize_callback_chain&lt;br /&gt;after_save&lt;br /&gt;after_save_callback_chain&lt;br /&gt;after_update&lt;br /&gt;after_update_callback_chain&lt;br /&gt;after_validation&lt;br /&gt;after_validation_callback_chain&lt;br /&gt;after_validation_on_create&lt;br /&gt;after_validation_on_create_callback_chain&lt;br /&gt;after_validation_on_update&lt;br /&gt;after_validation_on_update_callback_chain&lt;br /&gt;aggregate_mapping&lt;br /&gt;alias_attribute&lt;br /&gt;alias_method_chain&lt;br /&gt;all&lt;br /&gt;allocate&lt;br /&gt;allow_concurrency&lt;br /&gt;allow_concurrency=&lt;br /&gt;ancestors&lt;br /&gt;as_load_path&lt;br /&gt;attr_accessible&lt;br /&gt;attr_accessor_with_default&lt;br /&gt;attr_internal&lt;br /&gt;attr_internal_accessor&lt;br /&gt;attr_internal_naming_format&lt;br /&gt;attr_internal_naming_format=&lt;br /&gt;attr_internal_reader&lt;br /&gt;attr_internal_writer&lt;br /&gt;attr_protected&lt;br /&gt;attr_readonly&lt;br /&gt;attribute_method_suffix&lt;br /&gt;attribute_types_cached_by_default&lt;br /&gt;attribute_types_cached_by_default=&lt;br /&gt;autoload&lt;br /&gt;autoload?&lt;br /&gt;average&lt;br /&gt;b64encode&lt;br /&gt;base_class&lt;br /&gt;before_create&lt;br /&gt;before_create_callback_chain&lt;br /&gt;before_destroy&lt;br /&gt;before_destroy_callback_chain&lt;br /&gt;before_save&lt;br /&gt;before_save_callback_chain&lt;br /&gt;before_update&lt;br /&gt;before_update_callback_chain&lt;br /&gt;before_validation&lt;br /&gt;before_validation_callback_chain&lt;br /&gt;before_validation_on_create&lt;br /&gt;before_validation_on_create_callback_chain&lt;br /&gt;before_validation_on_update&lt;br /&gt;before_validation_on_update_callback_chain&lt;br /&gt;belongs_to&lt;br /&gt;benchmark&lt;br /&gt;blank?&lt;br /&gt;breakpoint&lt;br /&gt;cache&lt;br /&gt;cache_attribute?&lt;br /&gt;cache_attributes&lt;br /&gt;cached_attributes&lt;br /&gt;calculate&lt;br /&gt;cattr_accessor&lt;br /&gt;cattr_reader&lt;br /&gt;cattr_writer&lt;br /&gt;changed&lt;br /&gt;changed?&lt;br /&gt;class&lt;br /&gt;class_eval&lt;br /&gt;class_inheritable_accessor&lt;br /&gt;class_inheritable_array&lt;br /&gt;class_inheritable_array_writer&lt;br /&gt;class_inheritable_hash&lt;br /&gt;class_inheritable_hash_writer&lt;br /&gt;class_inheritable_reader&lt;br /&gt;class_inheritable_writer&lt;br /&gt;class_name&lt;br /&gt;class_name_of_active_record_descendant&lt;br /&gt;class_of_active_record_descendant&lt;br /&gt;class_variable_defined?&lt;br /&gt;class_variables&lt;br /&gt;clear_active_connection_name&lt;br /&gt;clear_active_connections!&lt;br /&gt;clear_reloadable_connections!&lt;br /&gt;clone&lt;br /&gt;colorize_logging&lt;br /&gt;colorize_logging=&lt;br /&gt;column_methods_hash&lt;br /&gt;column_names&lt;br /&gt;columns&lt;br /&gt;columns_hash&lt;br /&gt;composed_of&lt;br /&gt;compute_type&lt;br /&gt;configurations&lt;br /&gt;configurations=&lt;br /&gt;connected?&lt;br /&gt;connection&lt;br /&gt;connection=&lt;br /&gt;const_defined?&lt;br /&gt;const_get&lt;br /&gt;const_missing&lt;br /&gt;const_set&lt;br /&gt;constants&lt;br /&gt;construct_calculation_sql&lt;br /&gt;construct_count_options_from_args&lt;br /&gt;content_columns&lt;br /&gt;copy_instance_variables_from&lt;br /&gt;count&lt;br /&gt;count_by_sql&lt;br /&gt;count_observers&lt;br /&gt;create&lt;br /&gt;create!&lt;br /&gt;create_reflection&lt;br /&gt;current_scoped_methods&lt;br /&gt;daemonize&lt;br /&gt;dclone&lt;br /&gt;debugger&lt;br /&gt;decode64&lt;br /&gt;decode_b&lt;br /&gt;decrement_counter&lt;br /&gt;default_timezone&lt;br /&gt;default_timezone=&lt;br /&gt;define_attribute_methods&lt;br /&gt;define_callbacks&lt;br /&gt;define_read_methods&lt;br /&gt;delegate&lt;br /&gt;delete&lt;br /&gt;delete_all&lt;br /&gt;delete_observer&lt;br /&gt;delete_observers&lt;br /&gt;deprecate&lt;br /&gt;deprecated_method_warning&lt;br /&gt;deprecation_horizon&lt;br /&gt;descends_from_active_record?&lt;br /&gt;destroy&lt;br /&gt;destroy_all&lt;br /&gt;display&lt;br /&gt;dup&lt;br /&gt;duplicable?&lt;br /&gt;enable_warnings&lt;br /&gt;encode64&lt;br /&gt;encode_quoted_value&lt;br /&gt;enum_for&lt;br /&gt;eql?&lt;br /&gt;equal?&lt;br /&gt;establish_connection&lt;br /&gt;execute_grouped_calculation&lt;br /&gt;execute_simple_calculation&lt;br /&gt;exists?&lt;br /&gt;expand_hash_conditions_for_aggregates&lt;br /&gt;expand_range_bind_variables&lt;br /&gt;extend&lt;br /&gt;extend_with_included_modules_from&lt;br /&gt;extended_by&lt;br /&gt;find&lt;br /&gt;find_by_sql&lt;br /&gt;find_hidden_method&lt;br /&gt;finder_needs_type_condition?&lt;br /&gt;first&lt;br /&gt;freeze&lt;br /&gt;frozen?&lt;br /&gt;gem&lt;br /&gt;generated_methods&lt;br /&gt;generated_methods?&lt;br /&gt;get_primary_key&lt;br /&gt;has_and_belongs_to_many&lt;br /&gt;has_many&lt;br /&gt;has_one&lt;br /&gt;hash&lt;br /&gt;human_attribute_name&lt;br /&gt;id&lt;br /&gt;include?&lt;br /&gt;include_root_in_json&lt;br /&gt;include_root_in_json=&lt;br /&gt;included_in_classes&lt;br /&gt;included_modules&lt;br /&gt;increment_counter&lt;br /&gt;inheritable_attributes&lt;br /&gt;inheritance_column&lt;br /&gt;inheritance_column=&lt;br /&gt;inherited&lt;br /&gt;inspect&lt;br /&gt;instance_eval&lt;br /&gt;instance_exec&lt;br /&gt;instance_method&lt;br /&gt;instance_method_already_implemented?&lt;br /&gt;instance_methods&lt;br /&gt;instance_of?&lt;br /&gt;instance_values&lt;br /&gt;instance_variable_defined?&lt;br /&gt;instance_variable_get&lt;br /&gt;instance_variable_names&lt;br /&gt;instance_variable_set&lt;br /&gt;instance_variables&lt;br /&gt;instantiate_observers&lt;br /&gt;is_a?&lt;br /&gt;json_class_name&lt;br /&gt;kind_of?&lt;br /&gt;last&lt;br /&gt;load&lt;br /&gt;local_constant_names&lt;br /&gt;local_constants&lt;br /&gt;lock_optimistically&lt;br /&gt;lock_optimistically=&lt;br /&gt;locking_column&lt;br /&gt;locking_column=&lt;br /&gt;locking_enabled?&lt;br /&gt;log_connections&lt;br /&gt;logger&lt;br /&gt;logger=&lt;br /&gt;match_attribute_method?&lt;br /&gt;mattr_accessor&lt;br /&gt;mattr_reader&lt;br /&gt;mattr_writer&lt;br /&gt;maximum&lt;br /&gt;method&lt;br /&gt;method_added&lt;br /&gt;method_defined?&lt;br /&gt;methods&lt;br /&gt;minimum&lt;br /&gt;module_eval&lt;br /&gt;mysql_connection&lt;br /&gt;name&lt;br /&gt;named_scope&lt;br /&gt;new&lt;br /&gt;nil?&lt;br /&gt;notify_observers&lt;br /&gt;object_id&lt;br /&gt;observers&lt;br /&gt;observers=&lt;br /&gt;parent&lt;br /&gt;parents&lt;br /&gt;partial_updates&lt;br /&gt;partial_updates=&lt;br /&gt;partial_updates?&lt;br /&gt;pluralize_table_names&lt;br /&gt;pluralize_table_names=&lt;br /&gt;preload_associations&lt;br /&gt;primary_key&lt;br /&gt;primary_key=&lt;br /&gt;primary_key_prefix_type&lt;br /&gt;primary_key_prefix_type=&lt;br /&gt;private_class_method&lt;br /&gt;private_instance_methods&lt;br /&gt;private_method_defined?&lt;br /&gt;private_methods&lt;br /&gt;protected_attributes&lt;br /&gt;protected_instance_methods&lt;br /&gt;protected_method_defined?&lt;br /&gt;protected_methods&lt;br /&gt;public_class_method&lt;br /&gt;public_instance_methods&lt;br /&gt;public_method_defined?&lt;br /&gt;public_methods&lt;br /&gt;quote_bound_value&lt;br /&gt;quote_value&lt;br /&gt;quoted_locking_column&lt;br /&gt;quoted_table_name&lt;br /&gt;rails_original_const_missing&lt;br /&gt;raise_if_bind_arity_mismatch&lt;br /&gt;read_inheritable_attribute&lt;br /&gt;readonly_attributes&lt;br /&gt;record_timestamps&lt;br /&gt;record_timestamps=&lt;br /&gt;reflect_on_aggregation&lt;br /&gt;reflect_on_all_aggregations&lt;br /&gt;reflect_on_all_associations&lt;br /&gt;reflect_on_association&lt;br /&gt;reflections&lt;br /&gt;remove_class&lt;br /&gt;remove_connection&lt;br /&gt;remove_subclasses&lt;br /&gt;remove_subclasses_of&lt;br /&gt;replace_bind_variables&lt;br /&gt;replace_named_bind_variables&lt;br /&gt;require&lt;br /&gt;require_association&lt;br /&gt;require_dependency&lt;br /&gt;require_library_or_gem&lt;br /&gt;require_mysql&lt;br /&gt;require_or_load&lt;br /&gt;reset_column_information&lt;br /&gt;reset_column_information_and_inheritable_attributes_for_all_subclasses&lt;br /&gt;reset_inheritable_attributes&lt;br /&gt;reset_locking_column&lt;br /&gt;reset_primary_key&lt;br /&gt;reset_sequence_name&lt;br /&gt;reset_subclasses&lt;br /&gt;reset_table_name&lt;br /&gt;respond_to?&lt;br /&gt;retrieve_connection&lt;br /&gt;returning&lt;br /&gt;sanitize&lt;br /&gt;sanitize_conditions&lt;br /&gt;sanitize_sql&lt;br /&gt;sanitize_sql_array&lt;br /&gt;sanitize_sql_for_assignment&lt;br /&gt;sanitize_sql_for_conditions&lt;br /&gt;sanitize_sql_hash&lt;br /&gt;sanitize_sql_hash_for_assignment&lt;br /&gt;sanitize_sql_hash_for_conditions&lt;br /&gt;schema_format&lt;br /&gt;schema_format=&lt;br /&gt;scope&lt;br /&gt;scoped&lt;br /&gt;scoped?&lt;br /&gt;scoped_methods&lt;br /&gt;scopes&lt;br /&gt;send&lt;br /&gt;send!&lt;br /&gt;sequence_name&lt;br /&gt;sequence_name=&lt;br /&gt;serialize&lt;br /&gt;serialized_attributes&lt;br /&gt;set_inheritance_column&lt;br /&gt;set_locking_column&lt;br /&gt;set_primary_key&lt;br /&gt;set_readonly_option!&lt;br /&gt;set_sequence_name&lt;br /&gt;set_table_name&lt;br /&gt;silence&lt;br /&gt;silence_stderr&lt;br /&gt;silence_stream&lt;br /&gt;silence_warnings&lt;br /&gt;single_threaded_active_connections&lt;br /&gt;single_threaded_scoped_methods&lt;br /&gt;singleton_methods&lt;br /&gt;skip_time_zone_conversion_for_attributes&lt;br /&gt;skip_time_zone_conversion_for_attributes=&lt;br /&gt;sti_name&lt;br /&gt;store_full_sti_class&lt;br /&gt;store_full_sti_class=&lt;br /&gt;store_full_sti_class?&lt;br /&gt;subclasses&lt;br /&gt;subclasses_of&lt;br /&gt;sum&lt;br /&gt;superclass&lt;br /&gt;superclass_delegating_accessor&lt;br /&gt;superclass_delegating_reader&lt;br /&gt;superclass_delegating_writer&lt;br /&gt;suppress&lt;br /&gt;table_exists?&lt;br /&gt;table_name&lt;br /&gt;table_name=&lt;br /&gt;table_name_prefix&lt;br /&gt;table_name_prefix=&lt;br /&gt;table_name_suffix&lt;br /&gt;table_name_suffix=&lt;br /&gt;taguri&lt;br /&gt;taguri=&lt;br /&gt;taint&lt;br /&gt;tainted?&lt;br /&gt;thread_safe_active_connections&lt;br /&gt;thread_safe_scoped_methods&lt;br /&gt;time_zone_aware_attributes&lt;br /&gt;time_zone_aware_attributes=&lt;br /&gt;to_a&lt;br /&gt;to_enum&lt;br /&gt;to_json&lt;br /&gt;to_param&lt;br /&gt;to_query&lt;br /&gt;to_s&lt;br /&gt;to_yaml&lt;br /&gt;to_yaml_properties&lt;br /&gt;to_yaml_style&lt;br /&gt;transaction&lt;br /&gt;type&lt;br /&gt;uncached&lt;br /&gt;unloadable&lt;br /&gt;untaint&lt;br /&gt;update&lt;br /&gt;update_all&lt;br /&gt;update_counters&lt;br /&gt;update_counters_with_lock&lt;br /&gt;update_counters_without_lock&lt;br /&gt;validate&lt;br /&gt;validate_callback_chain&lt;br /&gt;validate_find_options&lt;br /&gt;validate_on_create&lt;br /&gt;validate_on_create_callback_chain&lt;br /&gt;validate_on_update&lt;br /&gt;validate_on_update_callback_chain&lt;br /&gt;validates_acceptance_of&lt;br /&gt;validates_associated&lt;br /&gt;validates_confirmation_of&lt;br /&gt;validates_each&lt;br /&gt;validates_exclusion_of&lt;br /&gt;validates_format_of&lt;br /&gt;validates_inclusion_of&lt;br /&gt;validates_length_of&lt;br /&gt;validates_numericality_of&lt;br /&gt;validates_presence_of&lt;br /&gt;validates_size_of&lt;br /&gt;validates_uniqueness_of&lt;br /&gt;verification_timeout&lt;br /&gt;verification_timeout=&lt;br /&gt;verify_active_connections!&lt;br /&gt;with_exclusive_scope&lt;br /&gt;with_options&lt;br /&gt;with_scope&lt;br /&gt;write_inheritable_array&lt;br /&gt;write_inheritable_attribute&lt;br /&gt;write_inheritable_hash&lt;br /&gt;yaml_as&lt;br /&gt;yaml_tag_class_name&lt;br /&gt;yaml_tag_read_class&lt;br /&gt;yaml_tag_subclasses?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-4411635532513292440?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/4411635532513292440/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=4411635532513292440' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/4411635532513292440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/4411635532513292440'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/07/activerecordbase.html' title='ActiveRecord::Base'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-343008799410246323</id><published>2008-07-08T13:12:00.000-07:00</published><updated>2008-07-08T23:39:30.218-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='templates'/><category scheme='http://www.blogger.com/atom/ns#' term='render'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.1'/><category scheme='http://www.blogger.com/atom/ns#' term='ActionView Base'/><category scheme='http://www.blogger.com/atom/ns#' term='view'/><title type='text'>ActionView Base</title><content type='html'>These are the public instance methods available for view (i.e. when templates are being rendered).&lt;br /&gt;&lt;h1&gt;View Methods&lt;/h1&gt;&lt;&lt;br /&gt;&lt;=&lt;br /&gt;&lt;=&gt;&lt;br /&gt;==&lt;br /&gt;===&lt;br /&gt;=~&lt;br /&gt;&gt;&lt;br /&gt;&gt;=&lt;br /&gt;__id__&lt;br /&gt;__send__&lt;br /&gt;`&lt;br /&gt;acts_like?&lt;br /&gt;alias_attribute&lt;br /&gt;alias_method_chain&lt;br /&gt;allocate&lt;br /&gt;ancestors&lt;br /&gt;as_load_path&lt;br /&gt;attr_accessor_with_default&lt;br /&gt;attr_internal&lt;br /&gt;attr_internal_accessor&lt;br /&gt;attr_internal_naming_format&lt;br /&gt;attr_internal_naming_format=&lt;br /&gt;attr_internal_reader&lt;br /&gt;attr_internal_writer&lt;br /&gt;autoload&lt;br /&gt;autoload?&lt;br /&gt;b64encode&lt;br /&gt;blank?&lt;br /&gt;breakpoint&lt;br /&gt;cache_template_extensions=&lt;br /&gt;cache_template_loading&lt;br /&gt;cache_template_loading=&lt;br /&gt;cattr_accessor&lt;br /&gt;cattr_reader&lt;br /&gt;cattr_writer&lt;br /&gt;class&lt;br /&gt;class_eval&lt;br /&gt;class_inheritable_accessor&lt;br /&gt;class_inheritable_array&lt;br /&gt;class_inheritable_array_writer&lt;br /&gt;class_inheritable_hash&lt;br /&gt;class_inheritable_hash_writer&lt;br /&gt;class_inheritable_reader&lt;br /&gt;class_inheritable_writer&lt;br /&gt;class_variable_defined?&lt;br /&gt;class_variables&lt;br /&gt;clone&lt;br /&gt;computed_public_paths&lt;br /&gt;const_defined?&lt;br /&gt;const_get&lt;br /&gt;const_missing&lt;br /&gt;const_set&lt;br /&gt;constants&lt;br /&gt;copy_instance_variables_from&lt;br /&gt;daemonize&lt;br /&gt;dclone&lt;br /&gt;debug_rjs&lt;br /&gt;debug_rjs=&lt;br /&gt;debugger&lt;br /&gt;decode64&lt;br /&gt;decode_b&lt;br /&gt;default_form_builder&lt;br /&gt;default_form_builder=&lt;br /&gt;delegate&lt;br /&gt;deprecate&lt;br /&gt;deprecated_method_warning&lt;br /&gt;deprecation_horizon&lt;br /&gt;display&lt;br /&gt;dup&lt;br /&gt;duplicable?&lt;br /&gt;enable_warnings&lt;br /&gt;encode64&lt;br /&gt;enum_for&lt;br /&gt;eql?&lt;br /&gt;equal?&lt;br /&gt;erb_trim_mode&lt;br /&gt;erb_trim_mode=&lt;br /&gt;erb_variable&lt;br /&gt;erb_variable=&lt;br /&gt;extend&lt;br /&gt;extend_with_included_modules_from&lt;br /&gt;extended_by&lt;br /&gt;field_error_proc&lt;br /&gt;field_error_proc=&lt;br /&gt;find_hidden_method&lt;br /&gt;freeze&lt;br /&gt;frozen?&lt;br /&gt;full_sanitizer&lt;br /&gt;full_sanitizer=&lt;br /&gt;gem&lt;br /&gt;hash&lt;br /&gt;helper_modules&lt;br /&gt;id&lt;br /&gt;include?&lt;br /&gt;included_in_classes&lt;br /&gt;included_modules&lt;br /&gt;inheritable_attributes&lt;br /&gt;inspect&lt;br /&gt;instance_eval&lt;br /&gt;instance_exec&lt;br /&gt;instance_method&lt;br /&gt;instance_methods&lt;br /&gt;instance_of?&lt;br /&gt;instance_values&lt;br /&gt;instance_variable_defined?&lt;br /&gt;instance_variable_get&lt;br /&gt;instance_variable_names&lt;br /&gt;instance_variable_set&lt;br /&gt;instance_variables&lt;br /&gt;is_a?&lt;br /&gt;kind_of?&lt;br /&gt;link_sanitizer&lt;br /&gt;link_sanitizer=&lt;br /&gt;load&lt;br /&gt;local_constant_names&lt;br /&gt;local_constants&lt;br /&gt;mattr_accessor&lt;br /&gt;mattr_reader&lt;br /&gt;mattr_writer&lt;br /&gt;method&lt;br /&gt;method_added&lt;br /&gt;method_defined?&lt;br /&gt;method_names&lt;br /&gt;method_names=&lt;br /&gt;methods&lt;br /&gt;module_eval&lt;br /&gt;name&lt;br /&gt;new&lt;br /&gt;nil?&lt;br /&gt;object_id&lt;br /&gt;parent&lt;br /&gt;parents&lt;br /&gt;private_class_method&lt;br /&gt;private_instance_methods&lt;br /&gt;private_method_defined?&lt;br /&gt;private_methods&lt;br /&gt;protected_instance_methods&lt;br /&gt;protected_method_defined?&lt;br /&gt;protected_methods&lt;br /&gt;public_class_method&lt;br /&gt;public_instance_methods&lt;br /&gt;public_method_defined?&lt;br /&gt;public_methods&lt;br /&gt;rails_original_const_missing&lt;br /&gt;read_inheritable_attribute&lt;br /&gt;remove_class&lt;br /&gt;remove_subclasses&lt;br /&gt;remove_subclasses_of&lt;br /&gt;require&lt;br /&gt;require_association&lt;br /&gt;require_dependency&lt;br /&gt;require_library_or_gem&lt;br /&gt;require_or_load&lt;br /&gt;reset_inheritable_attributes&lt;br /&gt;respond_to?&lt;br /&gt;returning&lt;br /&gt;sanitized_allowed_attributes&lt;br /&gt;sanitized_allowed_attributes=&lt;br /&gt;sanitized_allowed_css_keywords&lt;br /&gt;sanitized_allowed_css_keywords=&lt;br /&gt;sanitized_allowed_css_properties&lt;br /&gt;sanitized_allowed_css_properties=&lt;br /&gt;sanitized_allowed_protocols&lt;br /&gt;sanitized_allowed_protocols=&lt;br /&gt;sanitized_allowed_tags&lt;br /&gt;sanitized_allowed_tags=&lt;br /&gt;sanitized_bad_tags&lt;br /&gt;sanitized_bad_tags=&lt;br /&gt;sanitized_protocol_separator&lt;br /&gt;sanitized_protocol_separator=&lt;br /&gt;sanitized_shorthand_css_properties&lt;br /&gt;sanitized_shorthand_css_properties=&lt;br /&gt;sanitized_uri_attributes&lt;br /&gt;sanitized_uri_attributes=&lt;br /&gt;send&lt;br /&gt;send!&lt;br /&gt;silence_stderr&lt;br /&gt;silence_stream&lt;br /&gt;silence_warnings&lt;br /&gt;singleton_methods&lt;br /&gt;subclasses&lt;br /&gt;subclasses_of&lt;br /&gt;superclass&lt;br /&gt;superclass_delegating_accessor&lt;br /&gt;superclass_delegating_reader&lt;br /&gt;superclass_delegating_writer&lt;br /&gt;suppress&lt;br /&gt;taguri&lt;br /&gt;taguri=&lt;br /&gt;taint&lt;br /&gt;tainted?&lt;br /&gt;to_a&lt;br /&gt;to_enum&lt;br /&gt;to_json&lt;br /&gt;to_param&lt;br /&gt;to_query&lt;br /&gt;to_s&lt;br /&gt;to_yaml&lt;br /&gt;to_yaml_properties&lt;br /&gt;to_yaml_style&lt;br /&gt;type&lt;br /&gt;unloadable&lt;br /&gt;untaint&lt;br /&gt;white_list_sanitizer&lt;br /&gt;white_list_sanitizer=&lt;br /&gt;with_options&lt;br /&gt;write_inheritable_array&lt;br /&gt;write_inheritable_attribute&lt;br /&gt;write_inheritable_hash&lt;br /&gt;yaml_as&lt;br /&gt;yaml_tag_class_name&lt;br /&gt;yaml_tag_read_class&lt;br /&gt;yaml_tag_subclasses?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-343008799410246323?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/343008799410246323/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=343008799410246323' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/343008799410246323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/343008799410246323'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/07/actionview-base.html' title='ActionView Base'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-7576560879560475863</id><published>2008-07-08T12:32:00.000-07:00</published><updated>2008-07-08T23:38:31.651-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='applicationcontroller'/><category scheme='http://www.blogger.com/atom/ns#' term='public instance methods'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.1'/><title type='text'>ApplicationController</title><content type='html'>These are the ancestors of the ApplicationController (i.e rails controller classes) and the available public instance methods. This as least helps me to understand the range of methods available which makes the API much more understandable.&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;Controller Methods&lt;/h1&gt;&lt;&lt;br /&gt;&lt;=&lt;br /&gt;&lt;=&gt;&lt;br /&gt;==&lt;br /&gt;===&lt;br /&gt;=~&lt;br /&gt;&gt;&lt;br /&gt;&gt;=&lt;br /&gt;__id__&lt;br /&gt;__send__&lt;br /&gt;`&lt;br /&gt;action_methods&lt;br /&gt;acts_like?&lt;br /&gt;add_template_helper&lt;br /&gt;after_filter&lt;br /&gt;after_filters&lt;br /&gt;alias_attribute&lt;br /&gt;alias_method_chain&lt;br /&gt;allocate&lt;br /&gt;allow_concurrency&lt;br /&gt;allow_concurrency=&lt;br /&gt;allow_forgery_protection&lt;br /&gt;allow_forgery_protection=&lt;br /&gt;ancestors&lt;br /&gt;append_after_filter&lt;br /&gt;append_around_filter&lt;br /&gt;append_before_filter&lt;br /&gt;append_view_path&lt;br /&gt;around_filter&lt;br /&gt;as_load_path&lt;br /&gt;asset_host&lt;br /&gt;asset_host=&lt;br /&gt;attr_accessor_with_default&lt;br /&gt;attr_internal&lt;br /&gt;attr_internal_accessor&lt;br /&gt;attr_internal_naming_format&lt;br /&gt;attr_internal_naming_format=&lt;br /&gt;attr_internal_reader&lt;br /&gt;attr_internal_writer&lt;br /&gt;autoload&lt;br /&gt;autoload?&lt;br /&gt;b64encode&lt;br /&gt;before_filter&lt;br /&gt;before_filters&lt;br /&gt;benchmark&lt;br /&gt;blank?&lt;br /&gt;breakpoint&lt;br /&gt;cache_configured?&lt;br /&gt;cache_page&lt;br /&gt;cache_store&lt;br /&gt;cache_store=&lt;br /&gt;cache_sweeper&lt;br /&gt;cached_session_options&lt;br /&gt;caches_action&lt;br /&gt;caches_page&lt;br /&gt;cattr_accessor&lt;br /&gt;cattr_reader&lt;br /&gt;cattr_writer&lt;br /&gt;class&lt;br /&gt;class_eval&lt;br /&gt;class_inheritable_accessor&lt;br /&gt;class_inheritable_array&lt;br /&gt;class_inheritable_array_writer&lt;br /&gt;class_inheritable_hash&lt;br /&gt;class_inheritable_hash_writer&lt;br /&gt;class_inheritable_reader&lt;br /&gt;class_inheritable_writer&lt;br /&gt;class_variable_defined?&lt;br /&gt;class_variables&lt;br /&gt;clone&lt;br /&gt;consider_all_requests_local&lt;br /&gt;consider_all_requests_local=&lt;br /&gt;const_defined?&lt;br /&gt;const_get&lt;br /&gt;const_missing&lt;br /&gt;const_set&lt;br /&gt;constants&lt;br /&gt;controller_class_name&lt;br /&gt;controller_name&lt;br /&gt;controller_path&lt;br /&gt;copy_instance_variables_from&lt;br /&gt;daemonize&lt;br /&gt;dclone&lt;br /&gt;debug_routes&lt;br /&gt;debug_routes=&lt;br /&gt;debugger&lt;br /&gt;decode64&lt;br /&gt;decode_b&lt;br /&gt;default_charset&lt;br /&gt;default_charset=&lt;br /&gt;default_layout&lt;br /&gt;delegate&lt;br /&gt;deprecate&lt;br /&gt;deprecated_method_warning&lt;br /&gt;deprecation_horizon&lt;br /&gt;display&lt;br /&gt;dup&lt;br /&gt;duplicable?&lt;br /&gt;enable_warnings&lt;br /&gt;encode64&lt;br /&gt;enum_for&lt;br /&gt;eql?&lt;br /&gt;equal?&lt;br /&gt;exempt_from_layout&lt;br /&gt;expire_page&lt;br /&gt;extend&lt;br /&gt;extend_with_included_modules_from&lt;br /&gt;extended_by&lt;br /&gt;filter_chain&lt;br /&gt;filter_parameter_logging&lt;br /&gt;find_hidden_method&lt;br /&gt;fragment_cache_store&lt;br /&gt;fragment_cache_store=&lt;br /&gt;freeze&lt;br /&gt;frozen?&lt;br /&gt;gem&lt;br /&gt;hash&lt;br /&gt;helper&lt;br /&gt;helper_attr&lt;br /&gt;helper_method&lt;br /&gt;helpers&lt;br /&gt;hidden_actions&lt;br /&gt;hide_action&lt;br /&gt;id&lt;br /&gt;include?&lt;br /&gt;included_in_classes&lt;br /&gt;included_modules&lt;br /&gt;inheritable_attributes&lt;br /&gt;inspect&lt;br /&gt;instance_eval&lt;br /&gt;instance_exec&lt;br /&gt;instance_method&lt;br /&gt;instance_methods&lt;br /&gt;instance_of?&lt;br /&gt;instance_values&lt;br /&gt;instance_variable_defined?&lt;br /&gt;instance_variable_get&lt;br /&gt;instance_variable_names&lt;br /&gt;instance_variable_set&lt;br /&gt;instance_variables&lt;br /&gt;is_a?&lt;br /&gt;kind_of?&lt;br /&gt;layout&lt;br /&gt;layout_conditions&lt;br /&gt;layout_list&lt;br /&gt;load&lt;br /&gt;local_constant_names&lt;br /&gt;local_constants&lt;br /&gt;logger&lt;br /&gt;logger=&lt;br /&gt;master_helper_module&lt;br /&gt;master_helper_module=&lt;br /&gt;mattr_accessor&lt;br /&gt;mattr_reader&lt;br /&gt;mattr_writer&lt;br /&gt;method&lt;br /&gt;method_added&lt;br /&gt;method_defined?&lt;br /&gt;methods&lt;br /&gt;module_eval&lt;br /&gt;name&lt;br /&gt;new&lt;br /&gt;nil?&lt;br /&gt;object_id&lt;br /&gt;optimise_named_routes&lt;br /&gt;optimise_named_routes=&lt;br /&gt;page_cache_directory&lt;br /&gt;page_cache_directory=&lt;br /&gt;page_cache_extension&lt;br /&gt;page_cache_extension=&lt;br /&gt;param_parsers&lt;br /&gt;param_parsers=&lt;br /&gt;parent&lt;br /&gt;parents&lt;br /&gt;perform_caching&lt;br /&gt;perform_caching=&lt;br /&gt;prepend_after_filter&lt;br /&gt;prepend_around_filter&lt;br /&gt;prepend_before_filter&lt;br /&gt;prepend_view_path&lt;br /&gt;private_class_method&lt;br /&gt;private_instance_methods&lt;br /&gt;private_method_defined?&lt;br /&gt;private_methods&lt;br /&gt;process&lt;br /&gt;process_cgi&lt;br /&gt;process_with_components&lt;br /&gt;process_with_exception&lt;br /&gt;protect_from_forgery&lt;br /&gt;protected_instance_methods&lt;br /&gt;protected_method_defined?&lt;br /&gt;protected_methods&lt;br /&gt;public_class_method&lt;br /&gt;public_instance_methods&lt;br /&gt;public_method_defined?&lt;br /&gt;public_methods&lt;br /&gt;rails_original_const_missing&lt;br /&gt;read_inheritable_attribute&lt;br /&gt;remove_class&lt;br /&gt;remove_subclasses&lt;br /&gt;remove_subclasses_of&lt;br /&gt;request_forgery_protection_options&lt;br /&gt;request_forgery_protection_options=&lt;br /&gt;request_forgery_protection_token&lt;br /&gt;request_forgery_protection_token=&lt;br /&gt;require&lt;br /&gt;require_association&lt;br /&gt;require_dependency&lt;br /&gt;require_library_or_gem&lt;br /&gt;require_or_load&lt;br /&gt;rescue_from&lt;br /&gt;rescue_handlers&lt;br /&gt;rescue_handlers=&lt;br /&gt;rescue_responses&lt;br /&gt;rescue_responses=&lt;br /&gt;rescue_templates&lt;br /&gt;rescue_templates=&lt;br /&gt;reset_inheritable_attributes&lt;br /&gt;resource_action_separator&lt;br /&gt;resource_action_separator=&lt;br /&gt;resources_path_names&lt;br /&gt;resources_path_names=&lt;br /&gt;respond_to?&lt;br /&gt;returning&lt;br /&gt;send&lt;br /&gt;send!&lt;br /&gt;session&lt;br /&gt;session=&lt;br /&gt;session_options&lt;br /&gt;session_options_for&lt;br /&gt;session_store&lt;br /&gt;session_store=&lt;br /&gt;silence&lt;br /&gt;silence_stderr&lt;br /&gt;silence_stream&lt;br /&gt;silence_warnings&lt;br /&gt;singleton_methods&lt;br /&gt;skip_after_filter&lt;br /&gt;skip_before_filter&lt;br /&gt;skip_filter&lt;br /&gt;subclasses&lt;br /&gt;subclasses_of&lt;br /&gt;superclass&lt;br /&gt;superclass_delegating_accessor&lt;br /&gt;superclass_delegating_reader&lt;br /&gt;superclass_delegating_writer&lt;br /&gt;suppress&lt;br /&gt;taguri&lt;br /&gt;taguri=&lt;br /&gt;taint&lt;br /&gt;tainted?&lt;br /&gt;to_a&lt;br /&gt;to_enum&lt;br /&gt;to_json&lt;br /&gt;to_param&lt;br /&gt;to_query&lt;br /&gt;to_s&lt;br /&gt;to_yaml&lt;br /&gt;to_yaml_properties&lt;br /&gt;to_yaml_style&lt;br /&gt;type&lt;br /&gt;unloadable&lt;br /&gt;untaint&lt;br /&gt;verify&lt;br /&gt;view_paths&lt;br /&gt;view_paths=&lt;br /&gt;with_options&lt;br /&gt;write_inheritable_array&lt;br /&gt;write_inheritable_attribute&lt;br /&gt;write_inheritable_hash&lt;br /&gt;yaml_as&lt;br /&gt;yaml_tag_class_name&lt;br /&gt;yaml_tag_read_class&lt;br /&gt;yaml_tag_subclasses?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-7576560879560475863?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/7576560879560475863/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=7576560879560475863' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7576560879560475863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7576560879560475863'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/07/applicationcontroller.html' title='ApplicationController'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-3796633145765390416</id><published>2008-06-26T22:47:00.000-07:00</published><updated>2008-06-26T23:13:38.391-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='named_scope'/><title type='text'>named_scope</title><content type='html'>in the *.rb models&lt;br /&gt;&lt;br /&gt;Class Profile &lt;&lt; ActiveRecord::Base&lt;br /&gt;  belongs_to: user&lt;br /&gt;  belongs_to: team&lt;br /&gt;  named_scope :captain, :conditions =&gt; { :role =&gt; "captain" }&lt;br /&gt;  named_scope :liverpool, :include :team, :conditions =&gt; { 'teams.name' =&gt; 'liverpool' }&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;This allows following:&lt;br /&gt;&lt;br /&gt;user.profile.liverpool #-&gt; finds all user profiles that are in the team liverpool&lt;br /&gt;user.profile.captain #-&gt; finds all user profiles that have the role of captain.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-3796633145765390416?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/3796633145765390416/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=3796633145765390416' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3796633145765390416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3796633145765390416'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/06/namedscope.html' title='named_scope'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-5801175790617039607</id><published>2008-06-26T22:39:00.000-07:00</published><updated>2008-06-26T22:47:18.320-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lambda'/><category scheme='http://www.blogger.com/atom/ns#' term='blocks'/><category scheme='http://www.blogger.com/atom/ns#' term='closures'/><category scheme='http://www.blogger.com/atom/ns#' term='methods'/><category scheme='http://www.blogger.com/atom/ns#' term='calls'/><title type='text'>Methods, Calls, Blocks, Closures &amp; Lambda</title><content type='html'>Excellent excellent article!!&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Method_Calls"&gt;http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Method_Calls&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-5801175790617039607?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/5801175790617039607/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=5801175790617039607' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/5801175790617039607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/5801175790617039607'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/06/methods-calls-blocks-closures-lambda.html' title='Methods, Calls, Blocks, Closures &amp; Lambda'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-1377844935106477311</id><published>2008-06-24T07:25:00.000-07:00</published><updated>2008-06-25T14:38:27.553-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='array'/><category scheme='http://www.blogger.com/atom/ns#' term='associations'/><category scheme='http://www.blogger.com/atom/ns#' term='gsub'/><category scheme='http://www.blogger.com/atom/ns#' term='refactoring'/><category scheme='http://www.blogger.com/atom/ns#' term='stuck'/><title type='text'>STUCK things</title><content type='html'>Associations.&lt;br /&gt;==========&lt;br /&gt;&lt;br /&gt;What i want to do....&lt;br /&gt;&lt;br /&gt;current_user.following_users.messages&lt;br /&gt;&lt;br /&gt;This should deliver a bunch of messages from all the users that the current user is following (a la twitter).&lt;br /&gt;&lt;br /&gt;I can't get it to work for the life of me.&lt;br /&gt;&lt;br /&gt;################################Here the migrations.&lt;br /&gt;&lt;br /&gt;User&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;create_table "users", :force =&gt; true do |t|&lt;br /&gt;   t.column :login,                     :string&lt;br /&gt;   t.column :email,                     :string&lt;br /&gt;   t.column :crypted_password,          :string, :limit =&gt; 40&lt;br /&gt;   t.column :salt,                      :string, :limit =&gt; 40&lt;br /&gt;   t.column :created_at,                :datetime&lt;br /&gt;   t.column :updated_at,                :datetime&lt;br /&gt;   t.column :remember_token,            :string&lt;br /&gt;   t.column :remember_token_expires_at, :datetime&lt;br /&gt;   t.column :activation_code, :string, :limit =&gt; 40&lt;br /&gt;   t.column :activated_at, :datetime  &lt;br /&gt; end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Message&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;   create_table :messages do |t|&lt;br /&gt;   t.string :message&lt;br /&gt;   t.integer :user_id&lt;br /&gt;   t.integer :movie_id&lt;br /&gt;   t.timestamps&lt;br /&gt; end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Following&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt; create_table :followings do |t|&lt;br /&gt;   t.integer :follower_user_id&lt;br /&gt;   t.integer :following_user_id&lt;br /&gt;&lt;br /&gt;   t.timestamps&lt;br /&gt; end&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;#############################Here the Models&lt;br /&gt;&lt;br /&gt;User&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;class User &lt; foreign_key =""&gt; :following_user_id,   :class_name =&gt; "Following"&lt;br /&gt;has_many :follower_users,:foreign_key =&gt; :follower_user_id, :class_name =&gt; "Following"&lt;br /&gt;has_many :messages&lt;br /&gt;has_many :messages, :through =&gt; :follower_users,:foreign_key =&gt; :follower_user_id, :class_name =&gt; "Following"&lt;br /&gt;has_many :movies, :through =&gt; :messages&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Message&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;class Message &lt; foreign_key =""&gt; :following_user_id,   :class_name =&gt; "Following"&lt;br /&gt;#  has_many :follower_users,:foreign_key =&gt; :follower_user_id, :class_name =&gt; "Following"&lt;br /&gt;end&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Following&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;class Following &lt; foreign_key =""&gt; :follower_user_id, :class_name =&gt; "User"   #id of the user that is following&lt;br /&gt;belongs_to :following_user,  :foreign_key =&gt; :following_user_id, :class_name =&gt; "User"  #id of the user that is being followed&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;+++++++++++++++++++++ my solution so far&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt; @user=User.find_by_id(params[:user_id])&lt;br /&gt;@following_users=@user.followings.each { |follow| follow.user_id }&lt;br /&gt;@messages=Message.find_all_by_user_id(@following_users)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Refactoring&lt;br /&gt;=========&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt; def get_page_count&lt;br /&gt;            results =  @doc.search("//td[@class='resultCount']/").first.to_s.gsub(/\./,"")&lt;br /&gt;            tmp_array=results.scan(/(\d+)-(\d+).*?(\d+)/)&lt;br /&gt;            myarray=tmp_array[0]&lt;br /&gt;            @max_pages_in_category = 1&lt;br /&gt;             if !myarray.nil?&lt;br /&gt;                  @max_pages_in_category= (myarray[2].to_i / 12)    # total number of items / itmes on a page&lt;br /&gt;                  if (myarray[2].to_i % 12) != 0 then @max_pages_in_category+=1 end&lt;br /&gt;                  @total_articles_in_category=myarray[2];&lt;br /&gt;             end&lt;br /&gt;      end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;   def render_products&lt;br /&gt;          titles =  @doc.search("//span[@class='srTitle']/")&lt;br /&gt;          titles.each do |title|&lt;br /&gt;              print "."&lt;br /&gt;               string=title.to_s&lt;br /&gt;               string.gsub!(/\(.+?\)/,"")&lt;br /&gt;               string.gsub!(/\[.+?\]/,"")&lt;br /&gt;               if @data_file!=0 : @data_file.puts @tags+":"+string end&lt;br /&gt;           end&lt;br /&gt;       end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-1377844935106477311?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/1377844935106477311/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=1377844935106477311' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/1377844935106477311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/1377844935106477311'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/06/stuck-things.html' title='STUCK things'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-6921681798824960319</id><published>2008-06-23T05:12:00.000-07:00</published><updated>2008-06-23T05:17:17.084-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='controller'/><category scheme='http://www.blogger.com/atom/ns#' term='form_for'/><category scheme='http://www.blogger.com/atom/ns#' term='nested'/><title type='text'>Form_for nested</title><content type='html'>when using nested controllers where forms in the views need to call a nested controller too:&lt;br /&gt;&lt;br /&gt; &lt;span style="font-size:78%;"&gt;&lt;% form_for([@user, @movie]) do |f| %&gt;&lt;br /&gt;  ...&lt;br /&gt; &lt;% end %&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This will call the :controller =&gt; :movie with the :action =&gt; post with the :user_id =&gt; @user.id&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-6921681798824960319?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/6921681798824960319/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=6921681798824960319' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6921681798824960319'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6921681798824960319'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/06/formfor-nested.html' title='Form_for nested'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-200324560783447849</id><published>2008-06-20T12:05:00.000-07:00</published><updated>2008-06-20T12:14:52.344-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='has_many'/><category scheme='http://www.blogger.com/atom/ns#' term='belongs_to'/><category scheme='http://www.blogger.com/atom/ns#' term='related'/><category scheme='http://www.blogger.com/atom/ns#' term='model'/><title type='text'>Model Relationships - has_many belongs_to</title><content type='html'>ModelOne&lt;br /&gt;has_many :model_twos&lt;br /&gt;has_many :model_threes, :through :model_two&lt;br /&gt;&lt;br /&gt;ModelTwo&lt;br /&gt;belongs_to :model_one&lt;br /&gt;belongs_to :model_three&lt;br /&gt;&lt;br /&gt;ModelThree&lt;br /&gt;has_many :model_twos&lt;br /&gt;has_many :model_ones, :through :model_two&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-200324560783447849?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/200324560783447849/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=200324560783447849' title='1 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/200324560783447849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/200324560783447849'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/06/model-relationships-hasmany-belongsto.html' title='Model Relationships - has_many belongs_to'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-5506032542558166887</id><published>2008-06-20T12:03:00.000-07:00</published><updated>2008-06-20T12:05:49.442-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scaffold'/><category scheme='http://www.blogger.com/atom/ns#' term='generate'/><category scheme='http://www.blogger.com/atom/ns#' term='-c'/><category scheme='http://www.blogger.com/atom/ns#' term='singular'/><category scheme='http://www.blogger.com/atom/ns#' term='rake'/><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><title type='text'>Rake Scaffold</title><content type='html'>ruby script/generate scaffold SingularModelName data_field_name:type -c&lt;br /&gt;&lt;br /&gt;The -c adds the file generated to the svn repository.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-5506032542558166887?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/5506032542558166887/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=5506032542558166887' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/5506032542558166887'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/5506032542558166887'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/06/rake-scaffold.html' title='Rake Scaffold'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-7937176799204627280</id><published>2008-06-20T11:28:00.000-07:00</published><updated>2008-06-20T11:58:29.941-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java script'/><category scheme='http://www.blogger.com/atom/ns#' term='related'/><category scheme='http://www.blogger.com/atom/ns#' term='model'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><category scheme='http://www.blogger.com/atom/ns#' term='auto complete'/><category scheme='http://www.blogger.com/atom/ns#' term='auto_complete'/><title type='text'>Auto Complete Related Models</title><content type='html'>Here is an auto_complete example that works accross 2 related models:&lt;br /&gt;&lt;br /&gt;movie&lt;br /&gt;has_many :messages&lt;br /&gt;&lt;br /&gt;messages&lt;br /&gt;belongs_to :movie&lt;br /&gt;&lt;br /&gt;This went in the messages new view.&lt;br /&gt;============================&lt;br /&gt;&lt;span style="font-size:78%;"&gt; &lt;%= text_field_with_auto_complete :movie, :movie_name, {:size =&gt; 50}, {:url =&gt; formatted_movies_path(:js), :method =&gt; :get, :param_name =&gt; 'search'} %&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;as you cannot use the regular auto_complete_for helper for auto complete across models the text_filed_with_auto_complete needs to  have a few more things added to it.&lt;br /&gt;&lt;br /&gt;:movie is the model name for the auto complete&lt;br /&gt;:movie_name will contain the input from the user&lt;br /&gt;The first {} contains the options for the input field&lt;br /&gt;The second {} contains the options for the java script&lt;br /&gt;&lt;br /&gt;in the first {} the field size is set to 50 with :size=&gt;50&lt;br /&gt;in the second {} the&lt;br /&gt;  :url tells the auto complete where to go to get its information to give back to the client. In this case its the path to the index function of the movie controller. (:js) means java script is the format to pass around&lt;br /&gt; :method make rails get information rather then post information (which normally happens with the information from an input field)&lt;br /&gt; :param_name set the name of the params hash key with the information being typed into the field.&lt;br /&gt;&lt;br /&gt;This was how the messages controller handled the create&lt;br /&gt;===========================================&lt;br /&gt;&lt;span style="font-size:78%;"&gt;def create&lt;br /&gt;@message = Message.new(params[:message])&lt;br /&gt;@message.movie=Movie.find_or_create_by_title(:title=&gt; params[:movie][:movie_name])&lt;br /&gt;@message.save&lt;br /&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is what happened on the movie index method&lt;br /&gt;======================================&lt;br /&gt;&lt;span style="font-size:78%;"&gt;  def index&lt;br /&gt;  @movies = Movie.find(:all, :limit =&gt; 20, :conditions =&gt; ['title LIKE?', "%#{params[:search]}%"])&lt;br /&gt;&lt;br /&gt;  respond_to do |format|&lt;br /&gt;    format.html # index.html.erb&lt;br /&gt;    format.js #{ render :html =&gt; @movies }&lt;br /&gt;    format.xml  { render :xml =&gt; @movies }&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;as you can see in the above the index.js.erb file will be rendered when java script is calling this controller method.&lt;br /&gt;&lt;br /&gt;This is what the index.js.erb file looks like&lt;br /&gt;================================&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;%= auto_complete_result @movies, :title %&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;This is a help method from auto complete which renders back the title value for the objects contained in the @movies instance.&lt;br /&gt;&lt;br /&gt;!!!!DONT FORGET to add the java script librarys in the layout.&lt;br /&gt;&lt;%= javascript_include_tag :defaults %&gt;&lt;br /&gt;&lt;br /&gt;One last thing: Here is the CSS for the auto_complete to add the CSS being used for model so that the defaults can be overridden.&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;.auto_complete {&lt;br /&gt;     position:absolute;&lt;br /&gt;     /*width:250; */&lt;br /&gt;     overflow: hidden;&lt;br /&gt;     white-space: nowrap;&lt;br /&gt;     background-color:white;&lt;br /&gt;     border:1px solid #888;&lt;br /&gt;     margin:0px;&lt;br /&gt;     padding:0px;&lt;br /&gt;     color: black;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.auto_complete ul {&lt;br /&gt;     list-style-type: none;&lt;br /&gt;     margin:0px;&lt;br /&gt;     padding:0px;&lt;br /&gt;     color: black;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.auto_complete ul li.selected&lt;br /&gt;{&lt;br /&gt;       background-color: #fff; /* #bbf; */&lt;br /&gt;       color: black;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.auto_complete ul li {&lt;br /&gt;     list-style-type: none;&lt;br /&gt;     display:block;&lt;br /&gt;     margin:0;&lt;br /&gt;     padding:2px;&lt;br /&gt;     height:16px;&lt;br /&gt;     color: black;&lt;br /&gt;}  &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-7937176799204627280?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/7937176799204627280/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=7937176799204627280' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7937176799204627280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7937176799204627280'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/06/auto-complete-related-models.html' title='Auto Complete Related Models'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-3550901033166910761</id><published>2008-06-20T11:20:00.000-07:00</published><updated>2008-06-20T11:27:18.843-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='file'/><category scheme='http://www.blogger.com/atom/ns#' term='form'/><category scheme='http://www.blogger.com/atom/ns#' term='upload'/><title type='text'>file upload</title><content type='html'>This file upload form was made to upload a , delimited text file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;% form_for(@category_movie,  :html =&gt; { :multipart =&gt; true }) do |f| -%&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;               &lt;span style="font-size:78%;"&gt;&lt;label for="dvd_data"&gt;Upload DVD DataFiles:&lt;/label&gt;&lt;br /&gt;&lt;br /&gt;              &lt;%= file_field_tag :dvd_data %&gt;&lt;/span&gt;                  &lt;/p&gt;&lt;p&gt;&lt;span style="font-size:78%;"&gt;&lt;%= submit_tag 'Create' %&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:78%;"&gt; &lt;% end -%&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-3550901033166910761?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/3550901033166910761/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=3550901033166910761' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3550901033166910761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3550901033166910761'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/06/file-upload.html' title='file upload'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-2300818390647635389</id><published>2008-06-20T11:13:00.000-07:00</published><updated>2008-06-20T11:26:16.068-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='text'/><category scheme='http://www.blogger.com/atom/ns#' term='file'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><category scheme='http://www.blogger.com/atom/ns#' term='upload'/><title type='text'>From file to DB through Controller</title><content type='html'>This method reads data from an uploaded file in a , delimited file and stores it in the database in the movies, categories and category_movies(join table).&lt;br /&gt;&lt;br /&gt;category name 1, category name 2, ...., category name x: movie title&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;def create&lt;br /&gt;&lt;br /&gt;  while (line=params[:dvd_data].gets)&lt;br /&gt;            title=line.scan(/ROOT:.*/).to_s.gsub(/ROOT:/,"")&lt;br /&gt;     categories=line.gsub(/ROOT:.*/,"").scan(/.+?,/)&lt;br /&gt;     categories.each do |category|&lt;br /&gt;                  category.gsub!(/,/,"")&lt;br /&gt;                  the_category = Category.find_or_create_by_name(:name =&gt; category)&lt;br /&gt;                  the_movie= Movie.find_or_create_by_title(:title =&gt; title.to_s)&lt;br /&gt;                 CategoryMovie.find_or_create_by_category_id_and_movie_id(:category_id =&gt;the_category.id, :movie_id=&gt; the_movie.id)&lt;br /&gt;           end&lt;br /&gt;  end&lt;/span&gt;            &lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;  respond_to do |format|&lt;br /&gt;     flash[:notice] = 'DataBase Updated With DVD titles and Categories'&lt;br /&gt;     format.html { redirect_to(category_movies_path) }&lt;br /&gt;     format.xml  { render :xml =&gt; @category_movie, :status =&gt; :created, :location =&gt; @category_movie }&lt;br /&gt;  end&lt;br /&gt; end&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-2300818390647635389?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/2300818390647635389/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=2300818390647635389' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/2300818390647635389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/2300818390647635389'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/06/from-file-to-db-through-controller.html' title='From file to DB through Controller'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-7587374534747705094</id><published>2008-05-22T01:24:00.000-07:00</published><updated>2008-05-22T03:38:14.231-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='uninstall'/><category scheme='http://www.blogger.com/atom/ns#' term='pkg'/><category scheme='http://www.blogger.com/atom/ns#' term='install'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc'/><category scheme='http://www.blogger.com/atom/ns#' term='ImageMagick'/><category scheme='http://www.blogger.com/atom/ns#' term='opensolaris'/><category scheme='http://www.blogger.com/atom/ns#' term='wget'/><category scheme='http://www.blogger.com/atom/ns#' term='cc'/><category scheme='http://www.blogger.com/atom/ns#' term='setup.rb'/><category scheme='http://www.blogger.com/atom/ns#' term='RMagick'/><title type='text'>Traps falls installing things, addons and packages</title><content type='html'>It turns out that using preconfigured binaries and packages are waste of time.&lt;br /&gt;For example. i install ruby using:&lt;br /&gt;&lt;br /&gt;useraccount&gt; pfexec pkg install ruby-dev&lt;br /&gt;&lt;br /&gt;The package was compiled on the SUN cc compiler - which is fine, but.....&lt;br /&gt;the setup.rb file of the ruby system has all the environment variables set from the machine it was compiled on - and not mine. Editing that file by hand to adapt the environment to my machine is a night mare.&lt;br /&gt;&lt;br /&gt;The RMagick gem and for that matter the source code both look at the environment in the setup.rb file and because nothing in there is relevant to my machine the install fails.&lt;br /&gt;&lt;br /&gt;useraccount&gt; pfexec uninstall ruby-dev&lt;br /&gt;useraccount&gt; su&lt;br /&gt;superuseraccount&gt; pfexec rm -r /ruby&lt;br /&gt;&lt;br /&gt;So the only way to do this properly is uninstall the ruby pkg, get rid of the installation from my file system, down load the source and compile it again.&lt;br /&gt;&lt;br /&gt;useraccount&gt; cd /export/home/tmp&lt;br /&gt;useraccount&gt;pfexec wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p110.tar.bz2&lt;br /&gt;useraccount&gt;pfexec bunzip2 -dc ruby-1.8.6-p110.tar.bz2 | tar xf -&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-7587374534747705094?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/7587374534747705094/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=7587374534747705094' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7587374534747705094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7587374534747705094'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/traps-falls-installing-things-addon-as.html' title='Traps falls installing things, addons and packages'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-8093232957057793794</id><published>2008-05-22T01:23:00.000-07:00</published><updated>2008-05-22T01:24:54.316-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='install'/><category scheme='http://www.blogger.com/atom/ns#' term='makefile'/><category scheme='http://www.blogger.com/atom/ns#' term='setup'/><category scheme='http://www.blogger.com/atom/ns#' term='setup.rb'/><category scheme='http://www.blogger.com/atom/ns#' term='gem'/><title type='text'>Using ruby setup.rb</title><content type='html'>This is a great place to read &lt;a href="http://209.85.129.104/search?q=cache:n10cDwdPD3gJ:i.loveruby.net/en/projects/setup/doc/usage.html+setup.rb+%22--rbconfig%22&amp;amp;hl=de&amp;amp;ct=clnk&amp;amp;cd=6&amp;amp;gl=de&amp;amp;client=firefox-a"&gt;about it&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-8093232957057793794?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/8093232957057793794/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=8093232957057793794' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/8093232957057793794'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/8093232957057793794'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/using-ruby-setuprb.html' title='Using ruby setup.rb'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-8055021085899797569</id><published>2008-05-21T23:53:00.000-07:00</published><updated>2008-05-21T23:59:37.670-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='restful_authentication'/><category scheme='http://www.blogger.com/atom/ns#' term='sendmail'/><category scheme='http://www.blogger.com/atom/ns#' term='opensolaris'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.0.2'/><title type='text'>Setting up sendmail</title><content type='html'>according to the man pages sendmail does not let you send mails outside your domain unless you allow it to.&lt;br /&gt;&lt;br /&gt;useraccount&gt; svccfg -s svc:/network/smtp:sendmail setprop config/local_only = false&lt;br /&gt;useraccount&gt; svcadm refresh svc:/network/smtp:sendmail&lt;br /&gt;useraccount&gt; svcadm restart svc:/network/smtp:sendmail&lt;br /&gt;&lt;br /&gt;testit&lt;br /&gt;&lt;br /&gt;useraccount&gt; sendmail someone@domain.com&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-8055021085899797569?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/8055021085899797569/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=8055021085899797569' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/8055021085899797569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/8055021085899797569'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/setting-up-sendmail.html' title='Setting up sendmail'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-1349788360484497652</id><published>2008-05-20T13:52:00.000-07:00</published><updated>2008-05-21T08:07:55.603-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc'/><category scheme='http://www.blogger.com/atom/ns#' term='ImageMagick'/><category scheme='http://www.blogger.com/atom/ns#' term='opensolaris'/><category scheme='http://www.blogger.com/atom/ns#' term='cc'/><category scheme='http://www.blogger.com/atom/ns#' term='RMagick'/><title type='text'>Installing RMagick and ImageMagick</title><content type='html'>OK this took a day to find out.&lt;br /&gt;RMagick wraps around ImageMagick so you need both of them.&lt;br /&gt;To install ImageMagic you need perl - which is fine but you won't be able to install (configure and make) if perl has been compiled with a c compiler from sun. It throws out -KPIC for gcc and it should send gcc a -fPIC when compiling.&lt;br /&gt;&lt;br /&gt;So move rename perl link in the /usr/bin and the the perl root directory wherever that might be forexample /perl&lt;br /&gt;&lt;br /&gt;get the stable perl source code from &lt;a href="http://www.perl.com/download.csp"&gt;perl.com&lt;/a&gt; and download it&lt;br /&gt;useraccount&gt; pfexec tar xvf perl_download&lt;br /&gt;useraccount&gt; pfexec perl_download&lt;br /&gt;useraccount&gt; pfexec ./Configure&lt;br /&gt;useraccount&gt; pfexec make&lt;br /&gt;useraccount&gt; pfexec make test&lt;br /&gt;useraccount&gt; pfexec make install&lt;br /&gt;&lt;br /&gt;perl should now be in /opt/bin/perl with a link to it from /usr/bin&lt;br /&gt;&lt;br /&gt;Once you have done that download &lt;a href="http://www.imagemagick.org/script/install-source.php#unix"&gt;ImageMagick&lt;/a&gt; source files&lt;br /&gt;useraccount&gt; pfexec tar xvf ImageMagick&lt;br /&gt;useraccount&gt; cd ImageMagick&lt;br /&gt;useraccount&gt; pfexec ./configure --disable-static --with-modules --without-perl --without-magick-plus-plus --with-quantum-depth=8 CC=gcc&lt;br /&gt;useraccount&gt; pfexec make&lt;br /&gt;useraccount&gt; pfexec make install&lt;br /&gt;&lt;br /&gt;ImageMagick should now be in /usr/local/bin&lt;br /&gt;&lt;br /&gt;Then test it with&lt;br /&gt;useraccount&gt; /usr/local/bin/convert logo: logo.gif&lt;br /&gt;&lt;br /&gt;I did most of the above based on the info &lt;a href="http://www.imagemagick.org/script/install-source.php#unix"&gt;here&lt;/a&gt; and &lt;a href="http://209.85.135.104/search?q=cache:ezEv_W5SXMUJ:kete.net.nz/documentation/topics/preview/160%3Fversion%3D17+Can%27t+find+MagickCore.h&amp;amp;hl=de&amp;amp;ct=clnk&amp;amp;cd=6&amp;amp;gl=de&amp;amp;client=firefox-a"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-1349788360484497652?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/1349788360484497652/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=1349788360484497652' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/1349788360484497652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/1349788360484497652'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/installing-rmagick-and-imagemagick.html' title='Installing RMagick and ImageMagick'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-9174569317902189032</id><published>2008-05-20T13:26:00.000-07:00</published><updated>2008-05-20T13:29:19.494-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='pagenate'/><category scheme='http://www.blogger.com/atom/ns#' term='will_pagenate'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.0.2'/><title type='text'>Installing will_pagenate</title><content type='html'>useraccount&gt; pfexec gem install mislav-will_paginate --source http://gems.github.com/&lt;br /&gt;&lt;br /&gt;&lt;a href="http://github.com/mislav/will_paginate/wikis/installation"&gt;manual&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-9174569317902189032?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/9174569317902189032/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=9174569317902189032' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/9174569317902189032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/9174569317902189032'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/installing-willpagenate.html' title='Installing will_pagenate'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-3061612453824996755</id><published>2008-05-20T11:53:00.000-07:00</published><updated>2008-05-20T12:00:58.580-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.0.2'/><category scheme='http://www.blogger.com/atom/ns#' term='acts_as_taggable_on_steroids'/><title type='text'>install plugin acts_as_taggable_on_steroids</title><content type='html'>ruby script/plugin install http://svn.viney.net.nz/things/rails/plugins/acts_as_taggable_on_steroids&lt;br /&gt;&lt;br /&gt;== Instructions&lt;br /&gt;&lt;br /&gt;This plugin is based on acts_as_taggable by DHH but includes extras&lt;br /&gt;such as tests, smarter tag assignment, and tag cloud calculations.&lt;br /&gt;&lt;br /&gt;== Installation&lt;br /&gt;&lt;br /&gt;  ruby script/plugin install http://svn.viney.net.nz/things/rails/plugins/acts_as_taggable_on_steroids&lt;br /&gt;&lt;br /&gt;== Usage&lt;br /&gt;&lt;br /&gt;=== Prepare database&lt;br /&gt;&lt;br /&gt;Generate and apply the migration:&lt;br /&gt;&lt;br /&gt;  ruby script/generate acts_as_taggable_migration&lt;br /&gt;  rake db:migrate&lt;br /&gt;&lt;br /&gt;=== Basic tagging&lt;br /&gt;&lt;br /&gt;Let's suppose users have many posts and we want those posts to have tags.&lt;br /&gt;The first step is to add +acts_as_taggable+ to the Post class:&lt;br /&gt;&lt;br /&gt;  class Post &lt; ActiveRecord::Base&lt;br /&gt;    acts_as_taggable&lt;br /&gt;   &lt;br /&gt;    belongs_to :user&lt;br /&gt;  end&lt;br /&gt; &lt;br /&gt;We can now use the tagging methods provided by acts_as_taggable, &lt;tt&gt;#tag_list&lt;/tt&gt; and &lt;tt&gt;#tag_list=&lt;/tt&gt;. Both these&lt;br /&gt;methods work like regular attribute accessors.&lt;br /&gt;&lt;br /&gt;  p = Post.find(:first)&lt;br /&gt;  p.tag_list # []&lt;br /&gt;  p.tag_list = "Funny, Silly"&lt;br /&gt;  p.save&lt;br /&gt;  p.tag_list # ["Funny", "Silly"]&lt;br /&gt; &lt;br /&gt;You can also add or remove arrays of tags.&lt;br /&gt;&lt;br /&gt;  p.tag_list.add("Great", "Awful")&lt;br /&gt;  p.tag_list.remove("Funny")&lt;br /&gt;&lt;br /&gt;=== Finding tagged objects&lt;br /&gt;&lt;br /&gt;To retrieve objects tagged with a certain tag, use find_tagged_with.&lt;br /&gt;&lt;br /&gt;  Post.find_tagged_with('Funny, Silly')&lt;br /&gt; &lt;br /&gt;By default, find_tagged_with will find objects that have any of the given tags. To&lt;br /&gt;find only objects that are tagged with all the given tags, use match_all.&lt;br /&gt;&lt;br /&gt;  Post.find_tagged_with('Funny, Silly', :match_all =&gt; true)&lt;br /&gt; &lt;br /&gt;See &lt;tt&gt;ActiveRecord::Acts::Taggable::InstanceMethods&lt;/tt&gt; for more methods and options.&lt;br /&gt;&lt;br /&gt;=== Tag cloud calculations&lt;br /&gt;&lt;br /&gt;To construct tag clouds, the frequency of each tag needs to be calculated.&lt;br /&gt;Because we specified +acts_as_taggable+ on the &lt;tt&gt;Post&lt;/tt&gt; class, we can&lt;br /&gt;get a calculation of all the tag counts by using &lt;tt&gt;Post.tag_counts&lt;/tt&gt;. But what if we wanted a tag count for&lt;br /&gt;an single user's posts? To achieve this we call tag_counts on the association:&lt;br /&gt;&lt;br /&gt;  User.find(:first).posts.tag_counts&lt;br /&gt; &lt;br /&gt;A helper is included to assist with generating tag clouds. Include it in your helper file:&lt;br /&gt;&lt;br /&gt;  module ApplicationHelper&lt;br /&gt;    include TagsHelper&lt;br /&gt;  end&lt;br /&gt; &lt;br /&gt;You can also use the &lt;tt&gt;counts&lt;/tt&gt; method on &lt;tt&gt;Tag&lt;/tt&gt; to get the counts for all tags in the database.&lt;br /&gt;&lt;br /&gt;  Tag.counts&lt;br /&gt;&lt;br /&gt;Here is an example that generates a tag cloud.&lt;br /&gt;&lt;br /&gt;Controller:&lt;br /&gt;&lt;br /&gt;  class PostController &lt; ApplicationController&lt;br /&gt;    def tag_cloud&lt;br /&gt;      @tags = Post.tag_counts&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt; &lt;br /&gt;View:&lt;br /&gt;  &lt;% tag_cloud @tags, %w(css1 css2 css3 css4) do |tag, css_class| %&gt;&lt;br /&gt;    &lt;%= link_to tag.name, { :action =&gt; :tag, :id =&gt; tag.name }, :class =&gt; css_class %&gt;&lt;br /&gt;  &lt;% end %&gt;&lt;br /&gt; &lt;br /&gt;CSS:&lt;br /&gt;&lt;br /&gt;  .css1 { font-size: 1.0em; }&lt;br /&gt;  .css2 { font-size: 1.2em; }&lt;br /&gt;  .css3 { font-size: 1.4em; }&lt;br /&gt;  .css4 { font-size: 1.6em; }&lt;br /&gt;&lt;br /&gt;=== Caching&lt;br /&gt;&lt;br /&gt;It is useful to cache the list of tags to reduce the number of queries executed. To do this,&lt;br /&gt;add a column named &lt;tt&gt;cached_tag_list&lt;/tt&gt; to the model which is being tagged. The column should be long enough to hold&lt;br /&gt;the full tag list and must have a default value of null, not an empty string.&lt;br /&gt;&lt;br /&gt;  class CachePostTagList &lt; ActiveRecord::Migration&lt;br /&gt;    def self.up&lt;br /&gt;      add_column :posts, :cached_tag_list, :string&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;  class Post &lt; ActiveRecord::Base&lt;br /&gt;    acts_as_taggable&lt;br /&gt;   &lt;br /&gt;    # The caching column defaults to cached_tag_list, but can be changed:&lt;br /&gt;    #&lt;br /&gt;    # set_cached_tag_list_column_name "my_caching_column_name"&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;The details of the caching are handled for you. Just continue to use the tag_list accessor as you normally would.&lt;br /&gt;Note that the cached tag list will not be updated if you directly create Tagging objects or manually append to the&lt;br /&gt;&lt;tt&gt;tags&lt;/tt&gt; or &lt;tt&gt;taggings&lt;/tt&gt; associations. To update the cached tag list you should call &lt;tt&gt;save_cached_tag_list&lt;/tt&gt; manually.&lt;br /&gt;&lt;br /&gt;=== Delimiter&lt;br /&gt;&lt;br /&gt;If you want to change the delimiter used to parse and present tags, set TagList.delimiter.&lt;br /&gt;For example, to use spaces instead of commas, add the following to config/environment.rb:&lt;br /&gt;&lt;br /&gt;  TagList.delimiter = " "&lt;br /&gt;&lt;br /&gt;=== Unused tags&lt;br /&gt;&lt;br /&gt;Set Tag.destroy_unused to remove tags when they are no longer being&lt;br /&gt;used to tag any objects. Defaults to false.&lt;br /&gt;&lt;br /&gt;  Tag.destroy_unused = true&lt;br /&gt;&lt;br /&gt;#######################################&lt;br /&gt;&lt;br /&gt;IMPORTANT: If you are using join table habtm then you can add&lt;br /&gt;&lt;br /&gt;:conditions =&gt; {} for example to somthing like p = Post.find(:first)&lt;br /&gt;&lt;br /&gt;i.e.&lt;br /&gt;&lt;br /&gt;p = Post.find(:first) :conditions =&gt; {user.id =&gt; current_user }&lt;br /&gt;&lt;br /&gt;this will allow you to set or access only the tags for a specific user is a situation where you might have a habtm user picture relationship where a user can add tags to thier pictures.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-3061612453824996755?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/3061612453824996755/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=3061612453824996755' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3061612453824996755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/3061612453824996755'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/install-plugin-actsastaggableonsteroids.html' title='install plugin acts_as_taggable_on_steroids'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-1105652879941648058</id><published>2008-05-20T11:46:00.000-07:00</published><updated>2008-06-03T13:17:30.295-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='install'/><category scheme='http://www.blogger.com/atom/ns#' term='attachement_fu'/><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.0.2'/><title type='text'>Install plugin attachement_fu</title><content type='html'>ruby script/plugin install attachment_fu&lt;br /&gt;&lt;br /&gt;create a scaffold&lt;br /&gt;=============&lt;br /&gt;ruby script/generate scaffold Photo parent_id:integer content_type:string filename:string size:integer width:integer height:integer&lt;br /&gt;&lt;br /&gt;photo migration&lt;br /&gt;=============&lt;br /&gt;&lt;br /&gt;class CreatePhotos &lt; default =""&gt; ""&lt;br /&gt;     t.string :content_type, :default =&gt; ""&lt;br /&gt;     t.string :filename, :default =&gt; ""&lt;br /&gt;     t.integer :size, :default =&gt; 0&lt;br /&gt;     t.integer :width, :default =&gt; 0&lt;br /&gt;     t.integer :height, :default =&gt; 0&lt;br /&gt;&lt;br /&gt;     t.timestamps&lt;br /&gt;   end&lt;br /&gt;   photo=Photo.new(:content_type=&gt;" image/jpeg", :filename=&gt;"default_avatar_1.jpg", :size =&gt; 4.kilobytes, :width=&gt;114, :height=&gt;150)&lt;br /&gt;   photo.save&lt;br /&gt;   photo=Photo.new(:parent_id =&gt; photo.id, :content_type=&gt;" image/jpeg", :filename=&gt;"default_avatar_1_thumb.jpg", :thumbnail =&gt; "thumb", :size =&gt; 4.kilobytes, :width=&gt;24, :height=&gt;32)&lt;br /&gt;   photo.save  &lt;br /&gt; end&lt;br /&gt;&lt;br /&gt; def self.down&lt;br /&gt;   drop_table :photos&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;photo.rb&lt;br /&gt;=======&lt;br /&gt;&lt;br /&gt;class Photo &lt; ActiveRecord::Base&lt;br /&gt; has_one :profile&lt;br /&gt;&lt;br /&gt;  has_attachment :content_type =&gt; :image,&lt;br /&gt;  :storage =&gt; :file_system,&lt;br /&gt;  :size =&gt; 1.kilobyte..20.kilobytes,&lt;br /&gt;  :resize_to =&gt; '150x150'&lt;br /&gt;#  :thumbnails =&gt; { :thumb =&gt; '32x32' }&lt;br /&gt;&lt;br /&gt;#  validates_numericality_of :size, :only_integer =&gt; true, :greater_than =&gt; 1.kilobyte, :less_than =&gt; 20.kilobytes, :message =&gt; "File size out of range"&lt;br /&gt;  #TODO get the regex for content type&lt;br /&gt;  #validates_format_of :content_type, :with =&gt; :image, :message =&gt; "Picture is not an image"&lt;br /&gt;  validates_presence_of :width, :on =&gt; :update, :message =&gt; "width missing"&lt;br /&gt;  validates_presence_of  :height, :on =&gt; :update, :messgae =&gt; "height missing"&lt;br /&gt;  validates_presence_of :filename, :on =&gt; :update, :message =&gt; "File name missing"&lt;br /&gt;   &lt;br /&gt;  #attr_accessible :filename, :content_type, :width, :height, :size&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;###########################################################################&lt;br /&gt;&lt;br /&gt;attachment-fu&lt;br /&gt;=============&lt;br /&gt;&lt;br /&gt;attachment_fu is a plugin by Rick Olson (aka technoweenie &lt;http: net=""&gt;) and is the successor to acts_as_attachment.  To get a basic run-through of its capabilities, check out Mike Clark's tutorial &lt;http: com="" cgi="" blosxom="" 2007="" 02="" fileuploadfu=""&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;attachment_fu functionality&lt;br /&gt;===========================&lt;br /&gt;&lt;br /&gt;attachment_fu facilitates file uploads in Ruby on Rails.  There are a few storage options for the actual file data, but the plugin always at a minimum stores metadata for each file in the database.&lt;br /&gt;&lt;br /&gt;There are three storage options for files uploaded through attachment_fu:&lt;br /&gt;File system&lt;br /&gt;Database file&lt;br /&gt;Amazon S3&lt;br /&gt;&lt;br /&gt;Each method of storage many options associated with it that will be covered in the following section.  Something to note, however, is that the Amazon S3 storage requires you to modify config/amazon_s3.yml and the Database file storage requires an extra table.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;attachment_fu models&lt;br /&gt;====================&lt;br /&gt;&lt;br /&gt;For all three of these storage options a table of metadata is required.  This table will contain information about the file (hence the 'meta') and its location.  This table has no restrictions on naming, unlike the extra table required for database storage, which must have a table name of db_files (and by convention a model of DbFile).&lt;br /&gt;&lt;br /&gt;In the model there are two methods made available by this plugins: has_attachment and validates_as_attachment.&lt;br /&gt;&lt;br /&gt;has_attachment(options = {})&lt;br /&gt;This method accepts the options in a hash:&lt;br /&gt;  :content_type     # Allowed content types.&lt;br /&gt;                    # Allows all by default.  Use :image to allow all standard image types.&lt;br /&gt;  :min_size         # Minimum size allowed.&lt;br /&gt;                    # 1 byte is the default.&lt;br /&gt;  :max_size         # Maximum size allowed.&lt;br /&gt;                    # 1.megabyte is the default.&lt;br /&gt;  :size             # Range of sizes allowed.&lt;br /&gt;                    # (1..1.megabyte) is the default.  This overrides the :min_size and :max_size options.&lt;br /&gt;  :resize_to        # Used by RMagick to resize images.&lt;br /&gt;                    # Pass either an array of width/height, or a geometry string.&lt;br /&gt;  :thumbnails       # Specifies a set of thumbnails to generate.&lt;br /&gt;                    # This accepts a hash of filename suffixes and RMagick resizing options.&lt;br /&gt;                    # This option need only be included if you want thumbnailing.&lt;br /&gt;  :thumbnail_class  # Set which model class to use for thumbnails.&lt;br /&gt;                    # This current attachment class is used by default.&lt;br /&gt;  :path_prefix      # path to store the uploaded files.&lt;br /&gt;                    # Uses public/#{table_name} by default for the filesystem, and just #{table_name} for the S3 backend.&lt;br /&gt;                    # Setting this sets the :storage to :file_system.&lt;br /&gt;  :storage          # Specifies the storage system to use..&lt;br /&gt;                    # Defaults to :db_file.  Options are :file_system, :db_file, and :s3.&lt;br /&gt;  :processor        # Sets the image processor to use for resizing of the attached image.&lt;br /&gt;                    # Options include ImageScience, Rmagick, and MiniMagick.  Default is whatever is installed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Examples:&lt;br /&gt;  has_attachment :max_size =&gt; 1.kilobyte&lt;br /&gt;  has_attachment :size =&gt; 1.megabyte..2.megabytes&lt;br /&gt;  has_attachment :content_type =&gt; 'application/pdf'&lt;br /&gt;  has_attachment :content_type =&gt; ['application/pdf', 'application/msword', 'text/plain']&lt;br /&gt;  has_attachment :content_type =&gt; :image, :resize_to =&gt; [50,50]&lt;br /&gt;  has_attachment :content_type =&gt; ['application/pdf', :image], :resize_to =&gt; 'x50'&lt;br /&gt;  has_attachment :thumbnails =&gt; { :thumb =&gt; [50, 50], :geometry =&gt; 'x50' }&lt;br /&gt;  has_attachment :storage =&gt; :file_system, :path_prefix =&gt; 'public/files'&lt;br /&gt;  has_attachment :storage =&gt; :file_system, :path_prefix =&gt; 'public/files',&lt;br /&gt;                 :content_type =&gt; :image, :resize_to =&gt; [50,50]&lt;br /&gt;  has_attachment :storage =&gt; :file_system, :path_prefix =&gt; 'public/files',&lt;br /&gt;                 :thumbnails =&gt; { :thumb =&gt; [50, 50], :geometry =&gt; 'x50' }&lt;br /&gt;  has_attachment :storage =&gt; :s3&lt;br /&gt;&lt;br /&gt;validates_as_attachment&lt;br /&gt;This method prevents files outside of the valid range (:min_size to :max_size, or the :size range) from being saved.  It does not however, halt the upload of such files.  They will be uploaded into memory regardless of size before validation.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;  validates_as_attachment&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;attachment_fu migrations&lt;br /&gt;========================&lt;br /&gt;&lt;br /&gt;Fields for attachment_fu metadata tables...&lt;br /&gt;in general:&lt;br /&gt;  size,         :integer  # file size in bytes&lt;br /&gt;  content_type, :string   # mime type, ex: application/mp3&lt;br /&gt;  filename,     :string   # sanitized filename&lt;br /&gt;that reference images:&lt;br /&gt;  height,       :integer  # in pixels&lt;br /&gt;  width,        :integer  # in pixels&lt;br /&gt;that reference images that will be thumbnailed:&lt;br /&gt;  parent_id,    :integer  # id of parent image (on the same table, a self-referencing foreign-key).&lt;br /&gt;                          # Only populated if the current object is a thumbnail.&lt;br /&gt;  thumbnail,    :string   # the 'type' of thumbnail this attachment record describes.&lt;br /&gt;                          # Only populated if the current object is a thumbnail.&lt;br /&gt;                          # Usage:&lt;br /&gt;                          # [ In Model 'Avatar' ]&lt;br /&gt;                          #   has_attachment :content_type =&gt; :image,&lt;br /&gt;                          #                  :storage =&gt; :file_system,&lt;br /&gt;                          #                  :max_size =&gt; 500.kilobytes,&lt;br /&gt;                          #                  :resize_to =&gt; '320x200&gt;',&lt;br /&gt;                          #                  :thumbnails =&gt; { :small =&gt; '10x10&gt;',&lt;br /&gt;                          #                                   :thumb =&gt; '100x100&gt;' }&lt;br /&gt;                          # [ Elsewhere ]&lt;br /&gt;                          # @user.avatar.thumbnails.first.thumbnail #=&gt; 'small'&lt;br /&gt;that reference files stored in the database (:db_file):&lt;br /&gt;  db_file_id,   :integer  # id of the file in the database (foreign key)&lt;br /&gt;&lt;br /&gt;Field for attachment_fu db_files table:&lt;br /&gt;data, :binary # binary file data, for use in database file storage&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;attachment_fu views&lt;br /&gt;===================&lt;br /&gt;&lt;br /&gt;There are two main views tasks that will be directly affected by attachment_fu: upload forms and displaying uploaded images.&lt;br /&gt;&lt;br /&gt;There are two parts of the upload form that differ from typical usage.&lt;br /&gt;1. Include ':multipart =&gt; true' in the html options of the form_for tag.&lt;br /&gt;  Example:&lt;br /&gt;    &lt;% form_for(:attachment_metadata, :url =&gt; { :action =&gt; "create" }, :html =&gt; { :multipart =&gt; true }) do |form| %&gt;&lt;br /&gt; &lt;br /&gt;2. Use the file_field helper with :uploaded_data as the field name.&lt;br /&gt;  Example:&lt;br /&gt;    &lt;%= form.file_field :uploaded_data %&gt;&lt;br /&gt;&lt;br /&gt;Displaying uploaded images is made easy by the public_filename method of the ActiveRecord attachment objects using file system and s3 storage.&lt;br /&gt;&lt;br /&gt;public_filename(thumbnail = nil)&lt;br /&gt;Returns the public path to the file.  If a thumbnail prefix is specified it will return the public file path to the corresponding thumbnail.&lt;br /&gt;Examples:&lt;br /&gt;  attachment_obj.public_filename          #=&gt; /attachments/2/file.jpg&lt;br /&gt;  attachment_obj.public_filename(:thumb)  #=&gt; /attachments/2/file_thumb.jpg&lt;br /&gt;  attachment_obj.public_filename(:small)  #=&gt; /attachments/2/file_small.jpg&lt;br /&gt;&lt;br /&gt;When serving files from database storage, doing more than simply downloading the file is beyond the scope of this document.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;attachment_fu controllers&lt;br /&gt;=========================&lt;br /&gt;&lt;br /&gt;There are two considerations to take into account when using attachment_fu in controllers.&lt;br /&gt;&lt;br /&gt;The first is when the files have no publicly accessible path and need to be downloaded through an action.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;def readme&lt;br /&gt;  send_file '/path/to/readme.txt', :type =&gt; 'plain/text', :disposition =&gt; 'inline'&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;See the possible values for send_file for reference.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The second is when saving the file when submitted from a form.&lt;br /&gt;Example in view:&lt;br /&gt;&lt;%= form.file_field :attachable, :uploaded_data %&gt;&lt;br /&gt;&lt;br /&gt;Example in controller:&lt;br /&gt;def create&lt;br /&gt;  @attachable_file = AttachmentMetadataModel.new(params[:attachable])&lt;br /&gt;  if @attachable_file.save&lt;br /&gt;    flash[:notice] = 'Attachment was successfully created.'&lt;br /&gt;    redirect_to attachable_url(@attachable_file)  &lt;br /&gt;  else&lt;br /&gt;    render :action =&gt; :new&lt;br /&gt;  end&lt;br /&gt;end&lt;/http:&gt;&lt;/http:&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-1105652879941648058?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/1105652879941648058/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=1105652879941648058' title='1 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/1105652879941648058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/1105652879941648058'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/install-plugin-attachementfu.html' title='Install plugin attachement_fu'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-2226212913814588203</id><published>2008-05-20T11:28:00.000-07:00</published><updated>2008-05-20T11:36:07.947-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='login'/><category scheme='http://www.blogger.com/atom/ns#' term='restful_authentication'/><category scheme='http://www.blogger.com/atom/ns#' term='logout'/><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='user'/><title type='text'>install plugin restfull_authentication</title><content type='html'>script/plugin source http://svn.techno-weenie.net/projects/plugins&lt;br /&gt;script/plugin/install restful_authentication&lt;br /&gt;&lt;br /&gt;script/generate authenticated user sessions&lt;br /&gt;&lt;br /&gt;To use:&lt;br /&gt;&lt;br /&gt; ./script/generate authenticated user sessions --include-activation&lt;br /&gt;&lt;br /&gt;The first parameter specifies the model that gets created in signup(typically a user or account model).  A model with migration is created, as well as a basic controller with the create method.&lt;br /&gt;&lt;br /&gt;The second parameter specifies the sessions controller name.  This is the controller that handles the actual login/logout function on the&lt;br /&gt;site.&lt;br /&gt;&lt;br /&gt;The third parameter (--include-activation) generates the code for a ActionMailer and its respective Activation Code through email.&lt;br /&gt;&lt;br /&gt;You can pass --skip-migration to skip the user migration.&lt;br /&gt;&lt;br /&gt;Also, add an observer to config/environment.rb if you chose the --include-activation option&lt;br /&gt;&lt;br /&gt; config.active_record.observers = :user_observer # or whatever you named your model&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-2226212913814588203?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/2226212913814588203/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=2226212913814588203' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/2226212913814588203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/2226212913814588203'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/install-plugin-restfullauthentication.html' title='install plugin restfull_authentication'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-6477133833006581777</id><published>2008-05-20T09:16:00.000-07:00</published><updated>2008-05-20T11:42:16.996-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='manual'/><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><title type='text'>SVN Helpful links</title><content type='html'>&lt;a href="http://www.yasashiisyndicate.org/wp-content/uploads/2006/05/subversion.html"&gt;http://www.yasashiisyndicate.org/wp-content/uploads/2006/05/subversion.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-6477133833006581777?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/6477133833006581777/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=6477133833006581777' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6477133833006581777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6477133833006581777'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/svn-helpful-links.html' title='SVN Helpful links'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-7949069484097161938</id><published>2008-05-20T08:57:00.000-07:00</published><updated>2008-06-11T04:12:56.997-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='generate'/><category scheme='http://www.blogger.com/atom/ns#' term='ignore'/><category scheme='http://www.blogger.com/atom/ns#' term='commit'/><category scheme='http://www.blogger.com/atom/ns#' term='opensolaris'/><category scheme='http://www.blogger.com/atom/ns#' term='add'/><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.0.2'/><title type='text'>Using Rails with SVN</title><content type='html'>1. mkdir getready&lt;br /&gt;2. cd getready&lt;br /&gt;3. rails projectname&lt;br /&gt;4. mv projectname trunk&lt;br /&gt;5. mkdir tags&lt;br /&gt;6. mkdir branches&lt;br /&gt;7. cd trunk/config&lt;br /&gt;8. mv database.yml database_example.yml&lt;br /&gt;9. cd ..&lt;br /&gt;10. rm -r  tmp/*&lt;br /&gt;11. rm -r  log/*&lt;br /&gt;12. cd ..&lt;br /&gt;13 svn import . http://path_to_repository -m "initial import"&lt;br /&gt;14. ...now you can get rid of getready folder - we dont need it anymore&lt;br /&gt;15. svn co http://path_to_project_trunk projectname&lt;br /&gt;16. cd projectname&lt;br /&gt;17. cp config/database_example.yml database.yml&lt;br /&gt;18. add passwords to the database entries&lt;br /&gt;19. svn propset svn:ignore database.yml config/&lt;br /&gt;20. svn propset svn:ignore "*" tmp/&lt;br /&gt;21. svn propset svn:ignore "*" logs/&lt;br /&gt;22. svn commit -m "ignoring files"&lt;br /&gt;23. svn copy http://from_repository_trunk http://repository_tag_path_REL_XXX -m "initial snapshot release"&lt;br /&gt;&lt;br /&gt;############################&lt;br /&gt;# just a few things to remember&lt;br /&gt;############################&lt;br /&gt;&lt;br /&gt;1. when generating a model, controller or scaffold use the following&lt;br /&gt;&lt;br /&gt;useraccount&gt;ruby script/generate scaffold angry farmer bales_of_hey:integer name -c&lt;br /&gt;&lt;br /&gt;DON'T FORGET THE -c AT THE END!!!&lt;br /&gt;&lt;br /&gt;2. When installing a plugin&lt;br /&gt;&lt;br /&gt;ruby script/install name_of_plugin -x&lt;br /&gt;&lt;br /&gt;also a great railscast on the basics.&lt;br /&gt;&lt;br /&gt;Working&lt;br /&gt;&lt;br /&gt;To see the status of the files in the repository use:&lt;br /&gt;&lt;br /&gt;useraccount&gt; svn status&lt;br /&gt;&lt;br /&gt;To commit changes to the files&lt;br /&gt;&lt;br /&gt;useraccount&gt; svn commit -m "somthing about what you are commiting"&lt;br /&gt;&lt;br /&gt;To add files that you have changes (they have a ? next to them when you see the status).&lt;br /&gt;&lt;br /&gt;useraccount&gt; svn add directory_and_name_of_file&lt;br /&gt;&lt;br /&gt;to ignore files&lt;br /&gt;&lt;br /&gt;useraccount&gt;  svn propset svn:ignore *.pyc dirname&lt;br /&gt;or&lt;br /&gt;useraccount&gt; svn propset svn:ignore dirname&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-7949069484097161938?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/7949069484097161938/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=7949069484097161938' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7949069484097161938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7949069484097161938'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/using-rails-with-svn.html' title='Using Rails with SVN'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-6719439920789718126</id><published>2008-05-20T07:25:00.000-07:00</published><updated>2008-05-20T11:44:18.528-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tags'/><category scheme='http://www.blogger.com/atom/ns#' term='assembla'/><category scheme='http://www.blogger.com/atom/ns#' term='install'/><category scheme='http://www.blogger.com/atom/ns#' term='ignore'/><category scheme='http://www.blogger.com/atom/ns#' term='branches'/><category scheme='http://www.blogger.com/atom/ns#' term='trunk'/><category scheme='http://www.blogger.com/atom/ns#' term='import'/><category scheme='http://www.blogger.com/atom/ns#' term='repository'/><category scheme='http://www.blogger.com/atom/ns#' term='checkout'/><category scheme='http://www.blogger.com/atom/ns#' term='setup'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.0.2'/><title type='text'>setting up svn with a rails 2.0.2 project</title><content type='html'>more or less got this from &lt;a href="http://solutions.treypiepmeier.com/2007/06/25/setting-up-a-new-rails-project-in-subversion/"&gt;here.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Go to the directory you want to set up the rails project in.&lt;br /&gt;&lt;br /&gt;then&lt;br /&gt;&lt;br /&gt;useraccount&gt; mkdir svn_setup&lt;br /&gt;useraccount&gt; cd svn_setup&lt;br /&gt;useraccount&gt; rails project_name -d mysql&lt;br /&gt;useraccount&gt; mv project_name trunk&lt;br /&gt;useraccount&gt; mkdir tags&lt;br /&gt;useraccount&gt; mkdir branches&lt;br /&gt;useraccount&gt; cd trunk&lt;br /&gt;useraccount&gt; rm -r tmp/*&lt;br /&gt;useraccount&gt; rm -r log/*&lt;br /&gt;useraccount&gt; mv config/database.yml database_example.yml&lt;br /&gt;useraccount&gt; cd ..&lt;br /&gt;useraccount&gt; svn import . url_of_svn_repository_space_on_assembla -m "initial repository import" --user name_of_assembla_user&lt;br /&gt;&lt;br /&gt;now the project should be in the svn repository in assembla&lt;br /&gt;&lt;br /&gt;now checkout the project from the repository in assembla to your localhost&lt;br /&gt;&lt;br /&gt;useraccount&gt; cd&lt;br /&gt;useraccount&gt; svn co url_of_svn_repository_space_on_assembla/trunk project_name&lt;br /&gt;&lt;br /&gt;project_name is now what you can work on and thus you can get rid of the svn_setup folder you made earlier.&lt;br /&gt;&lt;br /&gt;useraccount&gt; rm -r svn_setup&lt;br /&gt;&lt;br /&gt;now for the last bits and bobs.&lt;br /&gt;&lt;br /&gt;useraccount&gt; cd project_name&lt;br /&gt;useraccount&gt; cp /config/database_example.yml database.yml&lt;br /&gt;&lt;br /&gt;useraccount&gt; svn propset svn:ignore database.yml config/&lt;br /&gt;useraccount&gt; svn propset svn:ignore "*" log/&lt;br /&gt;useraccount&gt; svn propset svn:ignore "*" tmp/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-6719439920789718126?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/6719439920789718126/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=6719439920789718126' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6719439920789718126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6719439920789718126'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/setting-up-svn-with-rails-202-project.html' title='setting up svn with a rails 2.0.2 project'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-6323868038597259617</id><published>2008-05-20T07:17:00.000-07:00</published><updated>2008-05-20T07:25:01.147-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='assembla'/><category scheme='http://www.blogger.com/atom/ns#' term='install'/><category scheme='http://www.blogger.com/atom/ns#' term='repository'/><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><title type='text'>Installing svn repository space on assembla</title><content type='html'>I would rather emulate what really might happen with a proper svn than use my local file system for a svn repository so &lt;a href="http://www.assembla.com/"&gt;sign up&lt;/a&gt; to &lt;a href="http://www.assembla.com"&gt;assembla.com&lt;/a&gt; and get some svn space.&lt;br /&gt;&lt;br /&gt;under the tab 'Trac/SVN' you will get the url of the SVN repository space.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-6323868038597259617?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/6323868038597259617/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=6323868038597259617' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6323868038597259617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6323868038597259617'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/installing-svn-repository-space-on.html' title='Installing svn repository space on assembla'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-6941315253491110320</id><published>2008-05-20T06:04:00.000-07:00</published><updated>2008-05-20T06:34:01.574-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='opensolaris'/><category scheme='http://www.blogger.com/atom/ns#' term='setup'/><title type='text'>Setting up mysql</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-family: verdana;"&gt;go to the user and groups setting in the gnome system administration menu and set the mysql user password to something that makes sense for you. Then give the mysql user a shell '/bin/bash' (setting in the advanced tab of user and groups) and then close all the windows with ok to set the changes.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;Then change to user mysql&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;useraccount&gt;su - mysql&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;password:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;and enter the mysql password&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;now you should have the bash promt:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;#bash&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;then enter&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;#bash&gt;mysql_install_db&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;then&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;#bash&gt;mysqld --skip-grant-tables &amp;amp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;then&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;#bash&gt;mysql&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;you should get the mysql promt&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;mysql&gt;UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;mysql&gt; FLUSH PRIVILEGES;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;############################&lt;br /&gt;############################&lt;br /&gt;&lt;br /&gt;now open a new terminal window....&lt;br /&gt;&lt;br /&gt;useraccount&gt; pfexec /usr/bin/svcadm enable database/mysql:version_50&lt;br /&gt;&lt;br /&gt;this should start the mysql database (pfexec /usr/bin/svcadm disable database/mysql:version_50 stops the database)&lt;br /&gt;&lt;br /&gt;if you want mysql to automatically start and stop with powerup and powerdown&lt;br /&gt;&lt;br /&gt;then do this (which i have not)&lt;br /&gt;&lt;br /&gt;pfexec /usr/sbin/svccfg import /var/svc/manifest/application/database/mysql.xml&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-6941315253491110320?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/6941315253491110320/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=6941315253491110320' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6941315253491110320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6941315253491110320'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/setting-up-mysql.html' title='Setting up mysql'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-6269347716813514720</id><published>2008-05-20T05:58:00.000-07:00</published><updated>2008-05-20T06:04:00.344-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='install'/><category scheme='http://www.blogger.com/atom/ns#' term='dont'/><category scheme='http://www.blogger.com/atom/ns#' term='AMP'/><title type='text'>DO NOT install AMP developers environment</title><content type='html'>Installing the reconfigured AMP environment for opensolaris caused me a lot of problems: machine not shutting down properly. not being able to shutdown via GNOME, not unmount startd properly and not getting any Internet when the machine boots up after a shutdown, which is not a shutdown but a restart instead.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-6269347716813514720?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/6269347716813514720/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=6269347716813514720' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6269347716813514720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/6269347716813514720'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/do-not-installing-amp-developers.html' title='DO NOT install AMP developers environment'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-742719068181467638</id><published>2008-05-20T05:51:00.000-07:00</published><updated>2008-05-20T05:58:10.308-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='install'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='opensolaris'/><title type='text'>Installing Mysql</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-family: verdana;"&gt;as a normal user&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;useraccount&gt;pexec pkg install SUNWmysql5&lt;br /&gt;&lt;br /&gt;This installs mysql in /usr/mysql&lt;br /&gt;&lt;br /&gt;Then change to su root and change the owner and groups of the files in etc and var as follows.&lt;br /&gt;&lt;br /&gt;root&gt;chown -R mysql:mysql /etc/mysql&lt;br /&gt;root&gt;chown -R mysql:mysql /var/mysql&lt;br /&gt;&lt;br /&gt;also see &lt;a href="http://dlc.sun.com/osol/docs/content/OSDEV/gentextid-48.html"&gt;docs&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-742719068181467638?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/742719068181467638/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=742719068181467638' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/742719068181467638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/742719068181467638'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/installing-mysql.html' title='Installing Mysql'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-1296512419162360115</id><published>2008-05-20T04:19:00.000-07:00</published><updated>2008-05-20T04:26:41.521-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='install'/><category scheme='http://www.blogger.com/atom/ns#' term='opensolaris'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.0.2'/><title type='text'>Installing Rails</title><content type='html'>&lt;span style="font-family:verdana;"&gt;as normal user (gems was installed with ruby).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;useraccount&gt;pfexec &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;gem install rails --include-dependencies&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Rails should now be in /usr/ruby/1.8&lt;/span&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-1296512419162360115?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/1296512419162360115/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=1296512419162360115' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/1296512419162360115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/1296512419162360115'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/installing-rails.html' title='Installing Rails'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3928934694684681974.post-7600694209598390636</id><published>2008-05-20T02:24:00.000-07:00</published><updated>2008-05-20T05:51:00.732-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='install'/><category scheme='http://www.blogger.com/atom/ns#' term='opensolaris'/><title type='text'>installing Ruby</title><content type='html'>&lt;span style="font-family:verdana;"&gt;Do as normal user account.&lt;br /&gt;&lt;br /&gt;useraccount&gt; pfexec pkg install ruby-dev&lt;br /&gt;&lt;br /&gt;ruby should now be in /usr/ruby&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3928934694684681974-7600694209598390636?l=jasonsrailsblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jasonsrailsblog.blogspot.com/feeds/7600694209598390636/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3928934694684681974&amp;postID=7600694209598390636' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7600694209598390636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3928934694684681974/posts/default/7600694209598390636'/><link rel='alternate' type='text/html' href='http://jasonsrailsblog.blogspot.com/2008/05/mysql.html' title='installing Ruby'/><author><name>jason's rails blog</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
