search for: peoplecontroller

Displaying 20 results from an estimated 23 matches for "peoplecontroller".

2008 Jun 28
19
Stopping example execution?
Hello, I''m wondering If I am missing something here when creating an example that sets an expecation at the top or beginning of an action but requires you to stub / mock everything that follows. Example: I want to test that a certain controller is running a before_filter...thats easy: - controller.should_receive(:require_user) - do_get But now i''ve got to mock / stub
2006 Jul 14
3
Accessing the Model class from Controller
Hi, I wonder if there''s an easy way to access the associated Model class from its Controller. Something that would allow me to write snippets like the following: class PeopleController < ApplicationController def some_method person_model_class = self.some_method_to_retrieve_the_person_model_class() end end Cheers, Marco -- Posted via http://www.ruby-forum.com/.
2009 Apr 19
19
Controller spec: testing that scope is set
In a Rails controller I set the scope on a model class in an around filter. I have defined expectations on the model classes, and ideally, I would add a further expectation for the scope. Is this already possible in some way? How would I go about adding support a scope expectation? Michael -- Michael Schuerig mailto:michael at schuerig.de http://www.schuerig.de/michael/
2005 Mar 30
2
Production Log Analyzer 1.1.0
...took 11.445382s ZeitgeistController#goals took 11.085795s Average Render Time: 0.128757978789508 Render Time Std Dev: 0.131171213785894 Slowest Total Render Times: TeamsController#progress took 4.698406s TeamsController#progress took 4.679505s PeopleController#doing_same_things took 3.628557s ThingsController#view took 3.34039s ThingsController#view took 2.096405s RssController#goals took 1.759452s EntriesController#view took 1.423261s ThingsController#view took 1.422453s ThingsController#...
2006 Apr 03
1
Best way to set custom Controller options
Hi All! I''m searching a good way to set some options in my Controllers; I tried defining a custom function, ie: class PeopleController < ApplicationController set_my_actions :action1, :action2 end class ApplicationController def self.set_my_actions(*args) @@my_actions = args end end But ''@@my_actions'' sets the class variable to _every_ Controllers classes! Any hints? Thanks, Marco...
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/.
2007 Apr 11
10
DRYer controller specs
So, I''ve been following the recommendations for controller specs here: http://blog.davidchelimsky.net/articles/2006/11/09/tutorial-rspec-stubs-and-mocks Most notably: a single expectation per specify block; the setup block contains only stubs; mock expectations each get their own specify block. (I''m still using 0.8, so I haven''t gotten the describe/it goodness yet.) I
2006 Jul 13
0
How to get dependent Model(s) from Controller
How can I get the dependent Model class from a Controller? I tried PeopleController.model and PeopleController.dependecies_on(:model) with no success. I''d like to avoid going through the Inflector.classify(self.controller_name) workaround. Thanks. Cheers, Marco
2006 Aug 01
2
The latest & greatest Routing (Rails Edge 4611)
Got a quick question regarding the latest and greatest: module ActionController module Routing SEPARATORS = %w( / ; . , ? ) Why is period (.) one of the separators? As it stands, the new routing code doesn''t recognize ''file.ext'' as the last component of a URL, which is sometimes defaulted to nil. See the generated code below. I don''t know everything
2006 Jun 28
0
ActiveResource (was: 1.1.3 available.)
...------- | SELECT | INSERT | UPDATE | DELETE | -------------------------------------- ---- slide C -------------------------------------------- POST /people/create GET /people/show/1 POST /people/update/1 POST /people/destroy/1 ---- slide D -------------------------------------------- class PeopleController < ActionController::Base def index @people = Person.find :all respond_to do |format| format.html # renders index.rhtml format.js # renders index.rjs format.xml { render :xml => @people.to_xml } format.icl { render_calendar(@people) } format.atom do...
2007 Aug 22
1
ActiveResource find method and restful controllers.
...d support for the activeresource find method in the controllers in my rails app? As I understand it when you invoke something like: Person.find(:all, :params => {:name = ''toby''}) this generates a request of: GET /people.xml?name=toby Does this mean that in my index method in PeopleController in my rails app I have params[name] set to toby? What is the best was of returning useful data from this find from within my controller i.e., how do I construct a find in the controller? Thanks, Toby --~--~---------~--~----~------------~-------~--~----~ You received this message because you are...
2009 Mar 31
3
Accept POST data from external source?
Ok, this is harder than I thought. I''ve got a hunk of XML coming in from an entirely external source that I do not control (but another department in my company does, so it''s not like a giant security hole). I was hoping to just have them POST their data to me, and then I''d read the raw stream and parse it. I''m sure folks know what I ran into -- Invalid
2006 Jul 31
3
Simply_RESTful and Bulk Import URLs
Hi, I have a people controller, and want to import bulk import multiple people from a CSV file. In my routes.rb file I have: map.resource :person Now, it''s a little unclear to me how to further configure the routes to allow me to add the following URLs: I need a URL to choose a file to upload, so I need an HTML ''frontend'' for it, so I figured the following URL
2007 Sep 11
0
How to test ''Paginate''?
Great Hi to everyone: I don''t know how to write spec for a controller method which has ''paginate''. Is there any Rspec API for it? To illustrate, I would like to post an example. class PeopleController def paginate_method hash = Hash.new hash[:people_page], hash[:people] = paginate :people, ...#order and conditions omitted render :partial=>"/index", :layout=>false, :locals=>{:hash=>hash} end end Does anyone who knows how to write spec on this method? I app...
2007 Sep 10
2
expire_page not working
...f expire_staff_page $stderr.puts "@@@@@ Expiring staff page" expire_page( :controller => ''welcome'', :action => ''staff'' ) $stderr.puts "@@@@@ Staff Page Expired" end end In my administrative controller, I have class Admin::PeopleController < Admin::AdminBaseController cache_sweeper :person_sweeper and finally, in the public controller, I have class WelcomeController < ApplicationController caches_page :staff When I hit the public ''staff'' page, the cache file is created. When changes are made to the u...
2012 Nov 03
0
ids writer fields for HABTM relationship.
...up the rails console and just do: [code] Person.first.role_ids = [1, 2, 3] [/code] Everything works so far. Now from the web browser, when trying to update a specific person, i get: [code] Started PUT "/people/1?_dc=1351904653950" for 127.0.0.1 at 2012-11-02 18:04:13 -0700 Processing by PeopleController#update as JSON Parameters: {"email"=>"jdoe-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org", "last_name"=>"DOE", "first_name"=>"John", "company_id"=>1, "created_at"=>"2012-11-02T22:27:00Z", "upda...
2006 Mar 29
0
has_and_belongs_to_many and collections management
...ng new entries for new values). * During a knowledge view, a list with all people that has a value for that knowledge, displaying the experience for each one. And this is what I started to code: * For person creation, I have the following in people_controller.rb on method "new": class PeopleController < ApplicationController def new @person = Person.new(@params[:person]) @knowledges = Knowledge.find(:all, :order => ''name'').collect { |k| [ k.name, k.id ] } @experiences = Experience.find(:all, :order => ''name'').collect { |k| [ k.name, k.id ] }...
2007 Nov 22
1
has_many :through questions
...use I want to eliminate redundant join records, i.e., there should be only one record in the attendees table that contains the combination of event_id=1 and person_id=1. I took "deleting and adding objects _as appropriate_" to mean that. Is this true? Secondly, trying this code in class PeopleController: @person.events = Event.find(@params[:event_ids]) if params[:event_ids] resulted in the following error: undefined method `events='' for #<Person:0x6836228> So, did I get something wrong or is this method not available with :through associations? If not available, is ther...
2006 Oct 24
4
Where to put a large constant?
In a registration form I allow the user to select several spoken languages and of course to minimize tomfoolery I am using selects. In the view I have: <%= select(''person'', ''language1'', LANGUAGES, options = {}) %> In my people_helper.rb I have: module PeopleHelper # constant for language selection in ''_form_background.rhtml''
2006 Jul 13
6
Render partial questions
Hello, what is the preferred way to do this... I have 2 controllers. Each has an index action. Now I want to include the rendered index view from TwoController in the index view of OneController. But a render :partial doesn''t execute the TwoController index action which sets variables for its index view. So maybe you can give me a short example how to do it. Thank you Markus