search for: find_by_id_and_user_id

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

2006 Jul 30
1
Bug? find_by_id(nil) returns object just created
..._by_id(nil) => #<Foo:0x2aaaac39dca0 @attributes={"name"=>"bar", "id"=>"7"}> Step: 3. Do the same find again: >> Foo.find_by_id(nil) => nil This only happens with any dynamic finder referencig ''id'' (i.e. find_by_id, find_by_id_and_user_id, etc.), not with any other attribute. I''m running Rails 1.1.4 on FC4, Mysql v. 4.1.14, Mysql-Ruby gem 2.7. It was replicated on Rails 1.1.1 on Debian stable, Mysql v. 4.1, Debian libmysql-ruby1.8 vs. 2.4.5-6.1. -------------- next part -------------- An HTML attachment was scrubbed... UR...
2010 Aug 08
2
issue with rescue_action_in_public! and testing 404 responses
...scue_action_in_public! to work? Or is this not the correct way to test missing records? My full example: (using factory_girl, rspec mocks and devise) it "respons with 404 when trying to edit non-existing reads" do rescue_action_in_public! sign_in(@user) Read.should_receive(:find_by_id_and_user_id!).with(2, @user.id).and_raise(ActiveRecord::RecordNotFound) get :edit, :id => 2 response.status.should eql 404 end and the exception: 1) ReadsController resources respons with 404 for non existing reads for GET /reads/2/edit Failure/Error: get :edit, :id => 2 ActiveRecor...
2008 Nov 27
7
will_paginate issue
Hi, I am trying paginate (will_paginate) users posts. It is counting and showing the page links correctly, but still showing all the posts on one page. @entries = @user.entries.paginate :per_page => 5, :page => params[:page], :order => ''created_at DESC'' If I change it to @entries = Entry.paginate :per_page => 5 ........ It is fine, but I would like to show only
2006 Oct 31
1
Help with DRY. I feel like im doing more then I have to.
Throughout my Message controller, I do this a lot: @message = Message.find(params[:id],:conditions => ["user_id = ?", @session[''user''].id]) Since you need to authenticate to use this app, is there a way i can tie the Accounts model in with the Message model so I dont have to pass in the user_id everytime? --~--~---------~--~----~------------~-------~--~----~ You
2006 Jan 07
8
exposing id''d
I have been working on a small app that started with some scaffolding. Some of my actions still have the structure where the id''s of things are passed on the url for gets. Whats the best way to avoid the security problems that this creates? I am sure that there are many pages written on this topic but I guess I have been searching for the wrong things. Thanks Gareth -- Posted via