search for: find_by_user

Displaying 4 results from an estimated 4 matches for "find_by_user".

2006 Nov 04
0
Need help with iterating through a ''find'' result
...#39;'ForumMember'' tracks each user''s status in each forum. ForumMember contains a foreign key to Forum, and to User. I have a main page in which I list all the Forums that a user is a member of. I gather this data easily in my controller, with: def list @forums = Forum.find_by_user(@session[''user''].id) end However, I wish to extend this page and display the user''s status in the Forum on the corresponding line. The user''s status is in ForumMember. I don''t wish to do a SQL query for each forum on the list, so I want to prepare ah...
2006 Nov 04
0
Basic Q: Please help with iterating through an AR.find result
...forum, if someone is a member of 10 forums, they have 10 ForumMember entries. Forum has_many ForumMembers, and ForumMember has_one Forum. I have a main page in which I list all the Forums that a user is a member of. I gather this data easily in my controller, with: def list @forums = Forum.find_by_user(@session[''user''].id) end However, I wish to extend this page and display the user''s status in the Forum on the corresponding line. The user''s status is in ForumMember. I don''t wish to do a SQL query for each forum on the list, so I want to prepare ah...
2007 May 24
9
Mocking, changing method interfaces and integration tests
Suppose we have a method ''foo'' which internally uses another method ''bar''. Being good BDDers we mock out the ''bar'' method. After all, we only want to spec the ''foo'' method - actually running the ''bar'' method means slower, less maintainable and brittler specs. That''s why we <3 mocking,
2009 Sep 01
13
Function Testing Reloading Fixtures before assertion
Hey Everyone, I have a function test the is failing (despite the fact the function actually works in the application). I was looking for some debug advice on how to find my problem. Here is the test: def test_should_delete_word assert_equal ''published'', words(:one).status debugger delete :destroy, :id => words(:one).to_param assert_equal