This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec_helper.rb | |
# Helper method to adding the fixtures into the tests | |
def fixtures(*files) | |
files.each do |file| | |
klass = begin | |
Kernel::const_get( | |
Extlib::Inflection.classify( | |
Extlib::Inflection.singularize(file.to_s))) | |
rescue | |
nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Helper method to adding the fixtures into the tests | |
def fixtures(*files) | |
files.each do |file| | |
klass = begin | |
Kernel::const_get(Extlib::Inflection.classify(Extlib::Inflection.singularize(file.to_s))) | |
rescue | |
nil | |
end | |
entries = YAML::load_file(File.dirname(__FILE__) + "/fixtures/#{file}.yml") | |
# do a migrate to create the table to clear the records |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create a link to an action. A confirm box will pop up before | |
# you can process to action specified here. | |
# link_to_action "Delete", "Are you sure?", :method => 'delete', | |
# :class => "negative", :controller => 'price_letters', | |
# :action => 'destroy', :id => letter.id | |
# link_to_action "Effect Now", "Take effect now, and can not be reversed?", | |
# :controller => "price_letters", :action => 'effect_now', :id => letter.id | |
def link_to_action(link_text, msg = "Are you sure", attributes = {}) | |
content = (msg || "Are you sure?") | |
attrs = { :method => 'post' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName app.myapp.com | |
DocumentRoot /Users/zhonghai/apps/ruby/current/public | |
# setting the env to development | |
RackEnv development | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# setting the env to development | |
RackEnv development | |
<VirtualHost *:80> | |
ServerName app.myapp.com | |
DocumentRoot /Users/zhonghai/apps/ruby/current/public | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dm 0.9.8 breaks YAML.dump | |
zooo = Zoo.all | |
File.open('zoo.yaml', 'w'){|f| YAML.dump(zooo, f)} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zooo = Zoo.all | |
File.open('zoo.yaml', 'w'){|f| f.puts zooo.to_yaml} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
z1 = Zoo.all(:condition.....) | |
z1.to_yaml # this OK | |
z2 = Zoo.all(:condition...) | |
z2.to_yaml # this OK | |
z3 = z1 + z2 | |
z3.to_yaml # bam!. ERROR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" all credits to antoine, | |
" more details see: http://blog.ant0ine.com/2007/03/ack_and_vim_integration.html | |
function! Ack(args) | |
let grepprg_bak=&grepprg | |
set grepprg=ack\ -H\ --nocolor\ --nogroup | |
execute "silent! grep " . a:args | |
botright copen | |
let &grepprg=grepprg_bak | |
endfunction | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% @pos.each |purchase_order| do %> | |
<%= form_for(purchase_order, :action => url(:create_po_purchasing_shopping_lists)) do %> | |
<%= hidden_field :name => "counter", :value => count %> | |
<%= partial 'purchasing/purchase_orders/basic_form', :po => po %> | |
<button class="positive" type="submit"> | |
<img alt="create" src="/images/icons/tick.png"></img> | |
Create | |
</button> | |
<% end =%> | |
<% end %> |
OlderNewer