class TheLazyCamel < RubyOnRails

  • Archive
  • RSS
  • Ask me anything
Taken with instagram
Pop-upView Separately

Taken with instagram

  • 3 weeks ago
  • Permalink
  • Share
    Tweet
Taken with instagram
Pop-upView Separately

Taken with instagram

  • 3 weeks ago
  • Permalink
  • Share
    Tweet
Taken with instagram
Pop-upView Separately

Taken with instagram

  • 2 months ago
  • Permalink
  • Share
    Tweet
Taken with instagram
Pop-upView Separately

Taken with instagram

  • 4 months ago
  • Permalink
  • Share
    Tweet
Taken with instagram
Pop-upView Separately

Taken with instagram

  • 5 months ago
  • Permalink
  • Share
    Tweet
Taken with instagram
Pop-upView Separately

Taken with instagram

  • 5 months ago
  • Permalink
  • Share
    Tweet

MacSequel | Mac OSX database query tool for Oracle

For when you have to see the Oracle

  • 5 months ago
  • Permalink
  • Share
    Tweet
s range in difficulty and for many the experience is inductive chain learning. That is, by solving one problem it will expose you to a new concept that allows you to undertake a previously inaccessibl
Project Euler

Source: projecteuler.net

  • 5 months ago
  • Permalink
  • Share
    Tweet

#yarorba - validations

So a couple of validations this week in the user model with test specs (obviously), max length of username, and validates email (using a regexp). Also tidy up the fields on validation, downcase, replace spaces with underscores, and remove all non-word characters.

commit can be seen here:

https://github.com/thelazycamel/yarorba/commit/0251400c0594ae74f8358c93df652b2fd86b8566

  • 6 months ago
  • Permalink
  • Share
    Tweet

#yarorba - update rails and onwards

Another week, another rails update, so lets update to rails 3.1.2 in the gemfile, then run bundle update, this installs a whole new load of gem updates :) lets hope it all still runs smoothly, by running rspec spec/.

Now time to do the user preferences on the right hand side, so start with a small model, and ill expand it later:

rails generate model UserPrefs image:string name:string

and attach the relationship:
/app/models/user.rb
has_one :user_prefs
/app/models/user_prefs.rb
belongs_to :user

oops forgot the user_id field, so lets create an additional migration
rails generate migration add_user_id_to_user_prefs
to the migration file:
add_column :user_prefs, :user_id, :integer
and the migrate
rake db:migrate

and write a spec for the user_prefs model:

describe UserPrefs do

it “Should belong to a user” do
user = Factory.create(:user)
user_prefs = UserPrefs.create(:image => “/test/url/image.jpg”, :name => “Stuart Hanscombe”, :user_id => user.id)
user.user_prefs.name.should == “Stuart Hanscombe”
end

end

and run the tests
rake db:test:prepare
rspec spec/


tests are all passing so, lets move on, next to build our first view partial:

so lots of view code, you can see the commit here:
https://github.com/thelazycamel/yarorba/commit/f870832c8190b328dfd1c6fa7b752985ef4bd00e
and here:
https://github.com/thelazycamel/yarorba/commit/8322fcd275d928898e9764c94a92851d1f13568e

  • 6 months ago
  • Permalink
  • Share
    Tweet
← Newer • Older →
Page 1 of 7

About

Avatar From Beginner to Ruby on Rails Master (Hopefully), teachings of the webs best programming language and web application framework.

Me, Elsewhere

  • @stuarthanscombe on Twitter
  • Linkedin Profile
  • thelazycamel on github

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr