August Lilleaas http://augustl.posterous.com "Lili-aws", not "Lilly-ass" posterous.com Sat, 05 Jun 2010 12:26:01 -0700 Lambdas in locales in Rails 3 http://augustl.posterous.com/lambdas-in-locales-in-rails-3 http://augustl.posterous.com/lambdas-in-locales-in-rails-3 A minor change to lambdas in locales: the key is now being passed as the first argument. What used to be `lambda {|c, path| "Do it: " + c.link_to("Thing",  path) } `  is now  `lambda {|key, c, path| "Do it: " + c.link_to("Thing",  path) } ` .

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/KESAAjNblD August Lilleaas augustl August Lilleaas
Thu, 03 Jun 2010 09:35:48 -0700 Using custom `map.connect` routes from inside resources in Rails 3 http://augustl.posterous.com/using-custom-mapconnect-routes-from-inside-re http://augustl.posterous.com/using-custom-mapconnect-routes-from-inside-re Here are some Rails 2 routes from gitorious.org.

[code lang='ruby']
map.resources :repositories do |repo|

  repo.resources :comments
  repo.trees "trees", :controller => "trees", :action => "index"
   repo.tree "trees/*branch_and_path", :controller => "trees", :action => "show"
end
[/code]

My first attempt at writing that in Rails 3 routes looked like this.

[code lang='ruby']
resources :repositories do
   resources :comments
   match "trees" => "trees#index", :as => :tree
   match "trees/*branch_and_path" => "trees#show", :as => :tree
end
[/code]

That broke the app with the message can't define route directly in resources scope.

You need to specify where the base should be: member or collection.

[code lang='ruby']
resources :repositories do
   resources :comments
   collection do
      match "trees" => "trees#index", :as => :tree
      match "trees/*branch_and_path" => "trees#show", :as => :tree
   end
end
[/code]

Rails 2 assumed you were working on the collection, Rails 3 doesn't.

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/KESAAjNblD August Lilleaas augustl August Lilleaas
Sat, 28 Feb 2009 03:30:57 -0800 Live Validations, now without jQuery http://augustl.posterous.com/live-validations-now-without-j http://augustl.posterous.com/live-validations-now-without-j Live Validations 0.2 has been released. It supports the livevalidation.com library, which is available as both a stand alone and a prototype version.

 http://github.com/leethal/live-validations/tree

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/KESAAjNblD August Lilleaas augustl August Lilleaas
Fri, 27 Feb 2009 07:10:53 -0800 Live Validations without jQuery http://augustl.posterous.com/live-validations-without-jquer http://augustl.posterous.com/live-validations-without-jquer The plugin is adapter based, which means that implementing adapters for libraries other than the jQuery validations library the plugin currently supports is on the horizon. Obviously, you shouldn't have to change JS library in order to use this plugin. http://www.livevalidation.com/ is library agnostic, I'll probably start there.

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/KESAAjNblD August Lilleaas augustl August Lilleaas
Fri, 27 Feb 2009 00:22:20 -0800 Live Validations http://augustl.posterous.com/live-validations-1 http://augustl.posterous.com/live-validations-1 It's usable now! 0.1 and all. Go get it at http://github.com/leethal/live-validations/tree.

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/KESAAjNblD August Lilleaas augustl August Lilleaas
Sat, 21 Feb 2009 14:34:00 -0800 Updated the Rest for Rails article http://augustl.posterous.com/updated-the-rest-for-rails-art http://augustl.posterous.com/updated-the-rest-for-rails-art

It's here.  Added some usage examples.

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/KESAAjNblD August Lilleaas augustl August Lilleaas
Thu, 19 Feb 2009 13:01:00 -0800 Live Validations http://augustl.posterous.com/live-validations http://augustl.posterous.com/live-validations

Just a short post to let ya all know that the Live Validations plugin is just around the corner now. Currently reading about C and Objective C and Cocoa, exciting stuff. Can't forget 'bout good ol' Ruby, tho'!

Here's a (really outdated) preview.

Permalink | Leave a comment  »

]]>
http://posterous.com/images/profile/missing-user-75.png http://posterous.com/users/KESAAjNblD August Lilleaas augustl August Lilleaas