Wednesday, May 28, 2008

Admin things--w/ steve

svnadmin create reposName
make your rails app in a temp dir
navigate one above rails app
svn import tester file:///home/usr/path/folder -m "comment"
delete your temp folder contents

----
REMEMBER:
svn file management is all through svn commands---
svn add
svn rename
svn commit
etc.

---

navigate into the temp folder
svn checkout file:///home/usr/path/file checkoutName
svn revert revertThisFile/* - your going to ask it to ignore these dirs
svn propset svn:ignore "*.log" log -ignore all of these


---

bring it home:
railsthings dave$ svn checkout svn+ssh://usrName@domain.com/home/usr/path/folder nameOfLocalFile

---

we made a rake task--check it out--it adds all our changes to the impending commit
svn commit -m "message"

curl - command line request

Monday, April 14, 2008

Adding Log Error to Debug Toolkit

logger.error "anything here"
in view just use erb

Thursday, March 6, 2008

New Rails 2.0.2 file

$ rails appName -d mysql appName
$ cd appName
$ rake rails:freeze:gems
$ rake db:create
$ [script/generate scaffold neededTableName columnName:dataType, ...]
$ mate .
(further configure migrations as needed)
$ rake db:migrate

Unix delete dir+contents

rm -r dir

Tuesday, March 4, 2008

More Rails 2.0

migrations-->foreign key--> t.references :table_name

Monday, March 3, 2008

Dream SSH access

ssh username@domain_name.com
pwd

RoR: From RyanB's Railscasts

Model.find_all_by_columnName(condition); --or simply find_by_columnName

Class method=> def self.method_name; move multi-use methods from controller to model

with_scope :method_root (ex. :find) => options do
method code
end

when iterating through blocks w/ method--> method to proc --> ex. find(:all).collect(&:name)

virtual attribute--> acts like any column--> define getter and setter methods w/ attribute name in model.
ex.
def full_name
[first_name, last_name].join(' ')
end

def full_name=(name)
split = name.split(' ', 2)
self.first_name = split.first
self.last_name = split.last
end
Named routes--> generic --> map.resources :modelName
custom-->map.custom_name ("route_root/:param1/:param2"), :controller=>controller_name, :action=>action_name

Seven default named routes embedded in map.resources :modelName
  • Index
  • Show
  • New
  • Create
  • Edit
  • Update
  • Destroy

fixtures --> dummy data moves with filesystem

add/remove columns to existing from prompt -->script/generate migration [add/remove]_columnName_[to/from]_tableName

new App--> need DB--> rake db:create

make_resourceful plugin-->
script/plugin install http://svn.hamptoncatlin.com/make_resourceful/tags/make_resourceful

in Controller:
make_resourceful do
actions :all
end