First Webapp

During my lunch break today, I opened up Ruby on Rails Tutorial and walked through setting up another first time app. So this is my 2nd app i’m working on.  I wanted to actually do something… so I decided to get something simple going and publish via Heroku. So what’s Continue Reading

Scopes

ScopesScopes allow you to define a query in a model.These can be called like ActiveRelation methodsThese can accept parameters Example, you could go to a model, like subject.rb and add:scope :visible, where(:visible => true)The symbol :visible is just that, a symbol. it could be anything, it’s just a reference to Continue Reading

Rails: ActiveRecord and ActiveRelation

ActiveRecord “active record” is a way of writing software (a software design pattern. )“ActiveRecord” is a rails implementation of  active record. Basically, it retrieves and manipulates db data as objects and NOT just as static rows.ActiveRecords lets the objects understand the structure and  they know how to interact with it.   Continue Reading

Rails Migrations (page 2)

Rails Migrations p2to roll a migration back, you run rake like this:rake db:migration VERSION=0 (0 tells it to go back to the beginning.) if you want to target a version, or environment you would do rake db:migration VERSION=[some version], RAILS_ENV=[some environment] The version numbers are in the “schema_migrations” table in Continue Reading

Rails: Migration (page 1)

Rails Migrations…are a set of db instructionswritten in RubyAllows you to migrate your db from one state to anotherContains both move up (to new state) and down (to a prev state) Why use it?Migrations keep the schema with the application code The Migration keeps all the db schema changes… and Continue Reading

setting up and using git with a public repo

I built out my first git remote repo – and published some code to it… It wasn’t as hard as it seemed to be… it seemed intimidating at first… but it wasn’t that bad… I just followed this tutorial on git:http://www.vogella.com/articles/Git/article.html#firstgit_content the repo is:git://github.com/wbwarnerb/demo-project.git

Rails Routing

Routing Types are simple, default and root. Simple An example would be like:                   get “demo/index”which is a shortcut for                    match “demo/index”, :to => “demo#index” this is saying when you get a request to go to: demo/index, to send to the controller#action (i.e. demo#index.) DefaultThis separates the controller action and Continue Reading