search for: personcontroller

Displaying 10 results from an estimated 10 matches for "personcontroller".

2007 Jun 05
6
Help with spec controller
Hello, I haven''t been able to create a controller spec. You can see the code here: http://pastie.caboo.se/67980 The error message I''m getting is: Spec::Mocks::MockExpectationError in ''PersonController should tell the Person model to create a new person on POST to create'' Mock ''person'' received unexpected message :save with (no args) /home/gramos/src/rails/dental/config/../app/controllers/person_controller.rb:26:in `create'' ./spec/controllers/person_controller_...
2007 May 29
5
Trouble defining a stub method for a controller
Hello, Not sure if I am doing something really wrong (let''s not say stupid for now), but I haven''t been able to stub a controller method like: controller.stub!(:logged_in?).and_return(true) Please help, this is driving me nuts ;-) -- An?bal Rojas http://www.rubycorner.com http://www.hasmanydevelopers.com
2006 Jun 29
6
Naming Convention for Controllers?
Hello! I just read DHH''s presentation pdf. In his examples, he wrote PeopleController instead of PersonController. I''ve been using singular words in controller''s name. Which is more common? Thanks. Sam -- Posted via http://www.ruby-forum.com/.
2006 Mar 30
2
acts_as_ordered plugin
...ext # Robert (does not wrap around to start) If you want the next and previous methods to wrap around the ends, use: acts_as_ordered :order => ''first_name'', :wrap => true You can use this in a application to be able to quickly browse through people. Eg: class PersonController < ApplicationController def view_neighbour # params[:direction] is passed off the page as ''next'' or ''previous'' @person = Person.find(params[:id]).send(params[:direction]) render :action => ''view'' end end Proble...
2006 Aug 16
1
update entry in a has_many relation
...one to many relation, but is doesn''t work. I can add or delete a specific entry, but I can''t update it. Can anyone help me? Here is the code: class Person < ActiveRecord::Base has_many :materials end class Material < ActiveRecord::Base belongs_to: person end class PersonController < ApplicationController def update person = Person.find(@params["id"]) person.name = @params["name"] first_material = person.materials.find(@params["material_id"]) first_material.size = @params["material_size"] person.updat...
2005 Jun 24
0
lighttpd - sporadic mysql errors
...from right after restarting lighttpd and killing all the procs, the second is the error after accessing the site half an hour later without having changed anything. Restarting lighttpd resolves the issue. What might be going on? ---------------------------------------------------- Processing PersonController#info (for 201.8.43.126 at Fri Jun 24 23:09:11 GMT 2005) Parameters: {"action"=>"info", "controller"=>"person"} ^[[4;33mSQL (0.000218)^[[m ^[[1;37mSET NAMES UTF8^[[m ^[[4;35mSurvey Load (0.000299)^[[m ^[[0;37mSELECT * FROM surveys WHERE su...
2005 Sep 29
0
:include doesn't respect :conditions of the included model
...has_one :last_planung :class_name => "Planung", :conditions => "exist IS TRUE", :order => "date DESC" end class Planung < ActiveRecord::Base belongs_to :person end And the corresponding controller looks like class PersonController < ApplicationController def index @person = Person.find(:all, :include => [:last_planung]) end end The actual problem is that the :include of :last_planung doesn''t respect the :conditions of last_planung. I can''t find anything in the docs mentioning this proble...
2006 Jul 10
4
Session variable data validation
I''ve been using rails for about a month and I''ve been noticing that most of my controller functions use values from my session variable. I find that I write something like: person = Person.find(session[:person] if( person ) # ... else flash[:notice] = "unable to retrieve person" redirect_to( :action => index ) end It seems redundant to write similar code for
2005 Feb 24
8
web services with ActionWebService
...apis/person_api.rb file is like this: class PersonAPI < ActionWebService::API::Base inflect_names false api_method :friends, :returns => [[:string]], :expects => [ {:mboxhash => :string} ] end And then in my app/controllers/person_controller.rb file I have: class PersonController < ApplicationController layout "xhtml11common", :except => :foaf def show @person = Person.find @params["id"] if @session["currentperson"] != nil @currentperson = Person.find @session["currentperson"] end...
2005 Mar 04
3
optimization
Ok, so, I''ve written my first app in rails. It''s pretty nifty. Only one problem. Slower than you could possibly comprehend. Processing PersonController#show (for 67.138.254.231 at Thu Mar 03 21:04:16 Eastern Standard Time 2005) Parameters: {:id=>"1", :controller=>"person", :action=>"show"} [4;35mPerson Load (0.219000) [0;37mSELECT * FROM people WHERE id = ''1'' LIMIT 1 [4;33mPerson Col...