similar to: spec''ing shared controller methods

Displaying 20 results from an estimated 600 matches similar to: "spec''ing shared controller methods"

2008 Jan 30
2
Stubbing controller methods vs model methods
I had an error that I couldn''t figure out, then when writing up a question for the forum I figured it out. The thing is I don''t understand why the change that was made works and why what existed before didn''t. Here is the initial post when I had the error: ---------------------------------- In the controllers/application.rb file I have a method that finds the account
2009 Aug 04
1
Output XML to File
I am trying to read some information based on a user id, then search the database for the needed info and build an XML file. Everything seems to be working fine; I read the info, I create the xml and even spit "stuff" out to file. The issue is that the "stuff" I am writing to a file is a xml/html cross cluster #@%$ of stuff. Here is some code: if !params[:id].blank?
2002 Dec 09
2
PDC: Problems making the win2k client join domain
I am having problems making the client win2k machine join the domain . My Samba PDC is configured as follows : 1>added trust account to the smbpasswd file (account to the win2k machine name). 2>set the global admin parameter to "student" (student acnt exists on smb server) Client is configured as follows : 1>user 'student' has been created . Problem : When I change
2006 Jun 05
2
When adding a record in console, a parameter comes in as null even when I set it
In console, I am trying to create a User but the :account_id does not come in. Console just gives me back :account_id => nil. Obviously I''m trying to set it though. Silly console... But, I can set the account_id column in my controller like so: @user = User.new(params[:user]) @user.account_id = account.id @user.save Here''s what I give to the controller: User.create :name
2013 Jul 16
1
Back to gspca
Ok... digging still more into this problem that I'm *still* fighting, using mplayer and a higher debug level, what I *think* the significant message is (this is just one example line): libv4lconvert: Error decompressing JPEG: fill_nbits error: need 5 more bits fps = 15.626953, interval = 0.096001, a_skew = 0.000000, corr_skew = 0.000000 vcnt = 1, acnt = 0 Which seems to indicate that for some
2006 Jan 11
3
How do you do a custom sql call in rails?
Hi. I am developing an industry specific crm that allows busineses to track customers in a particular way. Each customer will be assigned a customer number. The first customer will have a customer number of 1, the second customer_number = 2, etc... Note that this customer number is not global but particular to the account that created the customer (see schema snip below). I need to have a
2010 Dec 02
8
CanCan issue when being very specific
So I got CanCan and Devise working well. I have two types of users: Admins and Nonadmins. Admins can edit all of Nonadmins profiles. The problem is, every user (either Admin or Nonadmin) belongs to an Account or Organization. Admins should only be able to edit users from their own Account or Organization. I was able to do that too. The problem is, I can''t display the Create New User
2009 Nov 27
2
update_attribute does not update
My server is running Rails 2.3.4...am I not doing this correctly or is something borked? >> c=Contact.last => #<Contact id: 24, name: "Larry", email: "larry-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org", phone: 2147483647, account_id: 8, created_at: "2009-11-27 18:16:25", updated_at: "2009-11-27 18:40:08", hide_name: false, hide_phone: false,
2006 Jun 19
3
Using set_primary_key breaks acts_as_tree with non-integer column
I just switched from using the standard "id" column into using my own primary key and generating my own unique id for each record. But, this breaks acts_as_tree. Because my new primary key is not an integer, it breaks the SQL query as follows: StatementInvalid in PagesController#create --------------------------------------------------------------------------------------
2008 Nov 12
5
dynamic condition for has_one and eager loading issue
Hi, I ve defined the following relation in one of my models with a dynamic where condition: has_one :selection, :foreign_key => ''object_id'', :conditions => ''selection_type = 1 and account_id = # {self.send(:account_id)}'' That works perfect, however when I try to eager load that relation I am getting the following error when doing a
2008 Jul 16
2
belongs_to causing endless loop on first call to save!
Hi, I have a situation I''m hoping someone out there may be able to shed some light on. I have a Rails app (2.1.0 on Ruby 1.8.7) with a wizard-based sign up process, that has recently been changed from storing incremental data in the database to having a medium sized object graph living in the user session until the user completes the entire sign up process (this is a business
2007 Dec 02
1
total_hits and conditions
Hi. I''m running 0.11.4. The problem I''m having, appears to have been solved before according to various posts I googled up, but possibly the fix got removed from 0.11.3 to 0.11.4? re = Entry.multi_search(''service'', [Ticket], options, {}) re.size 620 re.total_hits 620 Now add conditions: re = Entry.multi_search(''service'', [Ticket],
2012 Sep 02
1
to_model
There''s a number of calls in the Rails source to convert_to_model, which takes an activerecord object instance: convert_to_model(object) Here''s the thing. All convert_to_model does is calls to_model, which returns self (the ActiveModel instance). Am I missing something here? Why call a method that returns the same thing? @user => #<User id: 3, name:
2007 Jul 09
3
NoMethodError when using find_by_sql
I''m try to verify users on login. Here is my code: def self.authenticate(username,password,account_code) employee = self.find(:all, :select => "e.id, e.first_name, e.last_name, e.username, e.account_id, e.department_id, o.pay_type_id, o.admin_yn, o.payroll_yn, o.files_yn, o.dept_report_yn,e.salt, e.hashed_password", :conditions => ["e.deleted_yn=0 and
2009 Jan 28
3
Newbie question about "grouping"
Hi folks: I am a SQL guy who just downloaded and installed R yesterday. I am trying to evaluate some "complex" aggregations we are currently performing with Syncsort (and have tried in Oracle) with R. I have loaded data in a dataframe and have performed some of the simple aggregations on a subset of data. What I do not see how to do though, is to "group" the aggregations
2006 Jul 19
2
Creating a safe sequence generator
Hi all, I''ve got a rails and database question. Accounts have jobs, and job numbers should be assigned per account. Account 89 should have jobs 1-whatever, which are not the same as account 67, which has jobs 1-whatever. In the past, I have accomplished this quite easily with: create table job ( accountid int(10) unsigned not null default 0, jobid int(10) unsigned not null
2005 Dec 29
7
belongs_to causing NoMethodError exceptions ... ?
I''ve got a really strange problem using belongs_to. I apologize in advance for the length... this is going to take a while to explain. Basic idea: Creating a User requires that the user enter an email address and activation key that matches an existing PendingUser. After creating the user successfully, that pending user should be marked as "used". The problem: When I
2009 Mar 11
3
[rspec, rails] Restful Routes in controller specs
Hi, how is it possible that I can use the restful routes helpers (e.g. new_user_path) in controller specs? I browsed the source code but I couldn''t find the magic. I''m just curious and would appreciate any hint... thanks Andi
2006 Jul 03
4
Display find(:include => [:children]) results in a view
I am trying to determine how to display a list returned from a Rails find(:include => [:children]). I am using the following (which works in the console): @patients = Account.find(session[:account_id]).patients.find(:all, :include => [:patient_details]) How can I address the patient_details to display them in the view? The console even shows a @patient_details instance variable
2004 Jun 23
0
connecting to Iconnect here using asterisk
Hi, I wish to connect several ATA186 Phones to each other, to iconnecthere and to the PSTN using asterisk. Please tell the appropriate settings for firewall (ports to open etc.) sip.conf and extensions.conf(part relevant to iconnect). Also I would be glad to get a working example of your ATA186 configuration. I tried searching the mailing lists and several sites but did not find an answer.