Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS 

Rails Date Formats

// cribbed from http://wiki.rubyonrails.org/rails/pages/HowToDefineYourOwnDateFormat

my_formats = {
  :my_format_1 => '%l %p, %b %d, %Y',
  :my_format_2  => '%l:%M %p, %B %d, %Y'
}

ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(my_formats)
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(my_formats)

Freeze Rails to Edge RC2 via SVN Externals

So you've already frozen to RC1, but need to upgrade to RC2?

cd ~/Sites/railsapp
svn propedit svn:externals vendor
# An editor will pop up, change RC1 to RC2 and save
svn up
svn ci -m "* Upgrade to RC2"


<3 SVN Externals

Bonus tip: I'm a habitual 'svn stat'er, and this helped speed up the process:

svn --ignore-externals stat

Freeze Rails to Edge RC1 via SVN Externals

cd vendor
svn propset svn:externals "rails http://dev.rubyonrails.org/svn/rails/tags/rel_1-2-0_RC1/" .
svn ci
svn up

One method for both displaying and processing 'new' items

From Goynang's comment

def new
  @post = Post.new(params[:post])
  if request.post? and @post.save
    flash[:notice] = 'Post was successfully created'
    redirect_to :action => 'index'
  end
end
« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS