search for: favorite_color

Displaying 5 results from an estimated 5 matches for "favorite_color".

2006 Jul 06
0
session scoped controllers
I was wondering if the notion of session scoped controllers has ever been discussed? The idea is that you could do something like this: def MyController < ActionController::SessionBase def step1 @favorite_color = params[:color] end def step2 # when step2 is hit by the user # @favorite_color would auto-magically be here puts "favorite color is #{@favorite_color}" end end I realize this could be accomplished by stashing stuff in the session, but I thought the abstraction migh...
2006 Jan 17
5
Hash.new{|h,k| h[k] = ""} ... but for views?
...hat key I receive an empty string. I would love to do something similar in my partials so that I wouldn''t have to worry about passing in every variable that is referenced. For example, if I have a partial ''_foo.rhtml'' as follows: <%= favorite_food %> <%= favorite_color %> ... and I attempt to render it with a call of: <%= render(:partial => ''foo'', :locals => {:favorite_food => "Anything but natto."}) %> ... then I''ll be scolded since I didn''t provide a value for ''favorite_...
2007 Nov 04
3
Returning the mock associated with an expectation.
I was reading through the FlexMock docs and noticed the expectation method .mock, which returns the original mock associated with an expectation. It looks really handy for writing nice all-in-one mocks like: mock_user = mock(''User'').expects(:first_name).returns(''Jonah'').mock So I started playing around with mocha and found I could actually already do this!
2008 Jan 02
2
Proxies
...Duncan'') > > then.expects(:last_name).returns(''Beevers'') > > > > later.expects(:birthday).returns(''a gentleman never asks'') > > then.expects(:astrological_sign).returns(''Virgo'') > > > > stubs(:favorite_color).returns(''silver'') > > > > finally.expects(:goodnight!).returns(''same to you'') > > end > > > > Where the temporal prefixes initially, finally, then and later > > indicate method call ordering, and expectations without a tempo...
2011 Aug 11
17
f.collection_select: what are the parameters?
The rails docs are so horrible on the collection_select method. They need to show a *complete* form, and show two examples: one that calls f.collection_select(), and another that calls collection_select(), and explain the differences. Given this line: f.collection_select :topic, Topic.all, :id, :category What the !@#$!@#$ is :topic? -- Posted via http://www.ruby-forum.com/. -- You received