similar to: using "find" when you have 2 has_many relations

Displaying 20 results from an estimated 2000 matches similar to: "using "find" when you have 2 has_many relations"

2006 Jan 20
4
Prepending table names on a per user or sub domain basis
Here is a sample of the database structure I want to have: someclientname-websites someclientname-canned_responses someclientname-canned_responses_websites anotherclientname-websites anotherclientname-canned_responses anotherclientname-canned_responses_websites As you can see I want to prepend the name of my future clients to the table name so that they use completely different sets of data. I
2012 Mar 13
2
[Arel]Building query, but can't get a proper output
I have the following code: advertisements_arel = Advertisement.order("advertisements.id DESC").arel @advertisements = (params[:website_id].present? ? advertisements_arel.where(:website_id => params[:website_id]) : advertisements_arel).to_a It returns a struct Arel::SelectManager::Row data But I''d like it to return an array of Advertisement objects (like it would
2011 Apr 16
4
Jabber / GTalk / hints
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi! Are hints not yet implemented in res_jabber? I have this here: exten => 3000,hint,gtalk/gtalk_account/mari.xxxxxxx at gmail.com But the hint doesn't show any difference. It always shows online on the phone and core show hints always shows that: 6003 at internal : SCCP/6003 State:Unavailable Watchers 0 6002 at internal :
2015 Jan 19
1
Meaning of core show hint output
Hi all If I have the following in my dialplan: exten=>25001,hint,SIP/25001 Doing a core show hint 25001 results in 25001 at local : SIP/25001 State:Idle Watchers 0 1 hint matching extension 25001 in the Asterisk CLI. What does the Watchers 0 mean? I use the hints table output via core show hints for logic in my dialler application - but
2005 Dec 28
3
Storing static info in table or model?
Hi, what are your thoughts on where and how to store static information like for example a countries list? I can''t decide whether I should store it as a table called Countries in the database or just create a non active record model that just lists the countries in a hard-coded array in the model file. Is one better than the other? -- Posted via http://www.ruby-forum.com/.
2006 Feb 24
1
Polycom IP 601 Buddy Watch doesn't work after Asterisk reload
Hi, I configured Buddy Watch function on my Polycom IP 601. It works well, until I make a reload of Asterisk. After reload, if I give the "show hints" command in Asterisk's CLI, it says that there are no watcher for the extensions that I configured. Before the reload in the CLI appears: -= Registered Asterisk Dial Plan Hints =- 3002 : SIP/3002 State:
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
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 --------------------------------------------------------------------------------------
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
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
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,
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
2006 Jan 19
4
A simple scaffolding question
All, When I generate scaffolding on my model, it doesn''t display all the fields in the create and edit views. It populates the views with text/char and date types, but omits any integer fields. Is this normal behavior or a bug? Thanks! -Nick
2006 Jan 17
30
MVC design good/bad
I am curious what you find is good and bad MVC design. Let''s use the find and find_by_sql methods as examples. Currently I have these spread out all over the place... View: here I have some find methods when I am for example populating a select list with choices in a form. Controller: here I have the simpler find methods. Model: here I have the more complicated find methods (usually
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
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 Oct 03
2
Explanation of how Scope works?
Hello all, I was wondering if someone could give me a brief explanation of how :scope works. I believe I''ve seen it used with the validation helpers in the past. - Jim
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 May 07
4
Paginate() from multiple tables
Hi I''m wondering if there''s a way I can gather data from multiple tables from the child table by using the paginate method? I would have done it using select_by_sql but I need it to paginate. My table structure is: Records is a child of Date and Account Date Account | | ^ ^ Records I want to be able to print a table using the Records controller that will
2007 Dec 04
1
spec''ing shared controller methods
I want to isolate and spec methods that are shared by controllers, and live in application.rb. Whereas I usually also provide examples in individual controllers that use these methods, not necessarily all the edge cases and I''d like to isolate the examples. This is the approach I''m taking (thanks to bryanl for suggestions and http://pastie.caboo.se/123626). WDYT? This