Skip to content

Instantly share code, notes, and snippets.

# Recursively add a .gitignore file to all directories
# in the working directory which are empty and don't
# start with a dot. Helpful for tracking empty dirs
# in a git repository.
for i in $(find . -type d -regex ``./[^.].*'' -empty); do touch $i"/.gitignore"; done;
# I always forget how easy this is... assuming r202 was the bad commit
# I just merge the *reverse* difference between r202 and r201
svn merge -r 202:201 http://svn.example.com/acme/trunk
svn diff # check it's right
svn ci -m "reversed out r202"
<% semantic_form_for @user do |form| %>
<%= form.inputs :title, :body, :section_id, :created_at %>
<%= form.buttons :commit %>
<% end %>
speechless:~/dev $ rails formtastic_test
create
create app/controllers
create app/helpers
... trimmed by JF
speechless:~/dev $ cd formtastic_test/
speechless:~/dev/formtastic_test $ ./script/plugin install git://github.com/justinfrench/formtastic.git
Initialized empty Git repository in .git/
warning: no common commits
remote: Counting objects: 26, done.
# 1. add this to formtastic_spec.rb inside the ":as => :select" describe block
it 'should have one option with a "selected" attribute' do
output_buffer.should have_tag('form li select option[@selected]', :count => 2) # the 2 is intentional
end
# 2. run the specs
expected
<form class="formtastic post" action="/posts" method="post" id="new_post"><li class="select optional" id="post_author_id_input"><label for="post_author_id">Author</label><select name="post[author_id]" id="post_author_id"><option value="37">Fred Smith</option>
git tag -am "annotation goes here" tagname_goes_here # cut a tag
git tag -d tagname_goes_here # burn it
git tag -am "annotation goes here" tagname_goes_here # cut another tag
git push --tags # push tags to remote
git push origin :refs/tags/tagname_goes_here # delete tag from remote
# http://rpheath.com/posts/409-rails-time-date-formatting-with-lambda
Time::DATE_FORMATS.merge!(
:friendly => lambda { |time|
if time.year == Time.now.year
time.strftime "%b #{time.day.ordinalize}"
else
time.strftime "%b #{time.day.ordinalize}, %Y"
end
}
Parameters: {
"commit"=>"Create Post",
"post"=>{
"thing_attributes"=>{
"name"=>"sdfgsdf",
"about"=>"sdfg"
},
"body"=>"sdfgsdg",
"title"=>"sdfgsdg",
"published"=>"0"},
# renders a post[author_attributes][login]
form_for(@new_post) do |post|
post.fields_for(:author) do |author|
concat(author.text_field(:login))
end
end
# renders a post[author][login]
form_for(@new_post) do |post|
post.fields_for(@new_post.author) do |author|
Rails CMS alternatives
======================
Note: project activity was checked on 11/26/09.
Active projects:
---------------
adva-cms
repo: http://github.com/svenfuchs/adva_cms/
site: http://adva-cms.org/
Last update: 11/24/09