Remco Swoany
2009-Jul-30 07:03 UTC
Store search paramters in database based on the current_user
Hi, This is my log-file output of the usercontroller. Processing UsersController#index (for 92.64.217.3 at 2009-07-30 08:57:46) [GET] Parameters: {"commit"=>"Search", "date"=>"", "arrival"=>"barcelona", "departure"=>"amsterdam"} What is the correct way the store the params in de database based on the current_user? remco -- Posted via http://www.ruby-forum.com/.
jhaagmans
2009-Jul-30 11:47 UTC
Re: Store search paramters in database based on the current_user
If I understand correctly you want to log these searches in the database, so you would probably want to do something like: Search.new(:date => params[:date], :arrival => params [:arrival], :departure => params[:departure], :user_id => current_user.id).save You might need to change current_user.id to match the way you call your current user. I could have misinterpreted the question, of course. Please tell me. Kind regards, Jaap Haagmans w. http://www.relywebsolutions.nl On 30 jul, 09:03, Remco Swoany <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > This is my log-file output of the usercontroller. > > Processing UsersController#index (for 92.64.217.3 at 2009-07-30 > 08:57:46) [GET] > Parameters: {"commit"=>"Search", "date"=>"", "arrival"=>"barcelona", > "departure"=>"amsterdam"} > > What is the correct way the store the params in de database based on the > current_user? > > remco > -- > Posted viahttp://www.ruby-forum.com/.
Remco Swoany
2009-Jul-30 12:49 UTC
Re: Store search paramters in database based on the current_user
jhaagmans wrote:> If I understand correctly you want to log these searches in the > database, so you would probably want to do something like: > > Search.new(:date => params[:date], :arrival => params > [:arrival], :departure => params[:departure], :user_id => > current_user.id).save > > You might need to change current_user.id to match the way you call > your current user. > > I could have misinterpreted the question, of course. Please tell me. > > Kind regards, > Jaap Haagmans > w. http://www.relywebsolutions.nl > > On 30 jul, 09:03, Remco Swoany <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>Hi Jaap, Zie dat je ned bent, dus ik vervolg in het ned. Het gewenste proces is als volgt. 1)Gebruiker logt in 2)Zoekt in zoekbox op vertrek en aankomst + datum (bijv amst - barcelona, 22 maart 2010) 3)Waarde van de zoekbox (search[params] moeten worden doorgegeven aan externe-url (partner) 3)De zoekcriteria opslaan zodat men later kan zien wat men heeft gezocht. (gekoppeld aan user_id) Heb jij ideeen? Bedankt alvast! Remco -- Posted via http://www.ruby-forum.com/.
jhaagmans
2009-Jul-30 16:06 UTC
Re: Store search paramters in database based on the current_user
> Hi Jaap, > > Zie dat je ned bent, dus ik vervolg in het ned.Prima!> > Het gewenste proces is als volgt. > > 1)Gebruiker logt in > 2)Zoekt in zoekbox op vertrek en aankomst + datum (bijv amst - > barcelona, 22 maart 2010) > 3)Waarde van de zoekbox (search[params] moeten worden doorgegeven aan > externe-url (partner)Heb je dit al geïmplementeerd? Anders is het mij niet geheel duidelijk. Wil je een remote call maken naar een andere website of moet de gebruiker doorgestuurd worden naar een andere website?> 3)De zoekcriteria opslaan zodat men later kan zien wat men heeft > gezocht. (gekoppeld aan user_id)Dat kan dus op bovenstaande manier. Je maakt gewoon een model "search" waarin je elke zoekopdracht opslaat. De attributen blijken wel uit mijn voorgaande reactie. Het enige attribuut dat je niet uit de parameters haalt is de user_id en ik denk dat je die ergens in een sessie hebt opgeslagen, nietwaar?> > Heb jij ideeen? Bedankt alvast! > > Remco > > -- > Posted viahttp://www.ruby-forum.com/.