search for: find_by_user_id

Displaying 7 results from an estimated 7 matches for "find_by_user_id".

2008 Apr 07
7
Saving attribute
Something is getting lost here. def create @home = Team.find_by_user_id(current_user.id) for player in @home.players player.update_attribute(:game_id, @game.id) end end def show @players = Player.find_all_by_game_id(params[:id]) end view <%= @players.size %> # mistakenly equals zero Played with the console and everything should be working fine...
2008 Mar 12
3
undefined method `each' for #<Usrecart:0x46d1678>
I have the an error such as undefined method ''each'' pls can any one find the error from the code given below <center><%=@b%></center> <center><h2>WELCOME IN YOUR PROFILE</h2> <%@usercart=Usrecart.find_by_user_id(@b)%> <%if @usercart.blank?%> <br> <br> <br> <br> <h2>THERE IS NO PRODUCT</h2> <%end%> <%if !@usercart.blank?%> <% for u in @usercart %> <% for column in u.content_columns %> <%=h u.send(colu...
2005 Dec 22
3
help with unless
Hi, I need a fresh set of eyes to look at this bit of controller code and tell me why I might be getting an error message: lookup = Profit.find(:all, :conditions => [ "user_id = ? AND product_id = ?", uid, pid]) unless lookup.empty? if (lookup.updated_on > 360.minutes.ago) return end end If lookup is empty, then I
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
2008 Apr 07
5
Associations errors
...end @school does exist cause i tried with .find(:first) and it gave the same error. Also I''m getting undefined method `reject'' for #<Game:0x24ca1c4> From @home.game_ids = @game @game = Game.new(params[:game]) @game.opponent = params[:team][:name] @home = Team.find_by_user_id(current_user.id) @opponent = Team.find_by_name(@game.opponent) if @game.save flash[:notice] = ''Game was successfully created.'' @home.game_ids = @game @opponent.game_ids = @game Here are my models class Game < ActiveRecord::Base has_and_bel...
2006 Feb 09
6
troubleshooting an observe_field
Hi, I''ve got a live_search field in a partial that is on several different pages. On all pages, except 1, it works fine. On the page it doesn''t work on, it seems it never executes it action. Here''s my observe_field code inside the partial: <h1><label for="searchtext">Live Search:</label></h1> <%= text_field_tag :searchtext
2006 Aug 17
7
preventing multiple logins
I want to set my app up to prevent multiple simultaneous logins by the same user. What strategies are people using? Is it worth going to database session storage just for this? martin