RailsCasts Pro episodes are now free!

Learn more or hide this

Benjamin Harmless Huber's Profile

GitHub User: bhh

Comments by Benjamin Harmless Huber

Avatar

what do you think of the assert_linear_performance idea.

http://www.revision-zero.org/benchmarking

i like the idea of asserting the complexity itself instead of a specific time value.
sure it's something different but as far as it concerns tests that could/should brake if violated this idea sound interesting.

Avatar

if you use the helpers like content_tag and use :data => { :articles => @articles }

they will be automatically converted to json and escaped correctly

Avatar

do you mean if the guest profile would only be a simple nullobject instead of a whole AR object with a table?

there should be some nice content
http://robots.thoughtbot.com/post/20907555103/rails-refactoring-example-introduce-null-object
https://www.destroyallsoftware.com/screencasts/catalog/how-and-why-to-avoid-nil

you could define a simple method

ruby
def active_profile
  profile or NullProfile.new
end

profile would be the normal association

Avatar

ok seems it got lost in 3.x ;) sorry for bothering

Avatar

http://blog.envylabs.com/post/29045466981/the-rails-state-machine

probably this would be nice too in the show notes.

it seems to me that not very much people know about the built-in version.

just used it once. i dont even know if its also built-in in the current version of rails