similar to: Parent id for find_or_create method

Displaying 20 results from an estimated 300 matches similar to: "Parent id for find_or_create method"

2012 Feb 07
2
save method (create action) saves twice
Rails 3.1.3 I have changed a regular scaffold action a bit so that it can save using ajax. All I needed to do was adding ":remote => true" in <div id="script_new"> <%= form_for script, :remote => true do |f| %> <!-- HERE!!! --> <%= f.hidden_field :video_id %> <%= f.text_field :text %> <%= f.submit "save" %>
2008 May 21
6
this.initialize has no properties error in Prototype Code
Hi All, I''m a super newbie with Prototype and am trying to implement my first solution using it. This is my code: var span = ''totalViews'' + video_id; var params = ''video_id='' + video_id; Ajax.Response(''trackVideo.php'', { method: ''post'', parameters: params, onSuccess: function(transport) {
2007 May 21
4
Spec''ing redirect with arbitrary parameters
I''ve got the following expectation: response.should redirect_to(:action => "new", :video_id => "1", :process_id => "2", :origin_id => "3") that fails with this error message: expected redirect to {:video_id=>"1", :process_id=>"2", :origin_id=>"3", :action=>"new"}, got redirect to
2007 Nov 30
2
find_by_sql preformance problems when ordering data
Hi, I am bumping into a small problem I was hoping someone could send me in the right direction on. I''m counting votes from a votes table to try to find the top ten videos. The following works really well, until I try to order it. It would seem that the order by is adding a 26 second delay, which surprised me since it was all done in sql. I revised the process to sort and publish on
2007 Feb 23
4
How can I spec this? The method gets passed a block...
I''m using Jim Weirich''s Builder library. The code I want to spec is xml.video do xml.id @video_id xml.views @views xml.date(@date.to_s) if @date end I''d like to mock it, rather than asserting that the XML is the right string. I can do one spec: specify "should create a video tag" do @mock_builder.should_receive(:video)
2007 Feb 21
1
Rendering all the elements when calling Array#to_xml
When I call to_xml on an array, I want it to get the XML for all the elements in it. I''ve defined to_xml in my class. >> r.to_xml => "<video><id>1</id><views>2</views></video>" >> a = [r] => [#<StatisticsReport:0x3259f38 @video_id=1, @views=2>] >> a.to_xml => "<?xml version=\"1.0\"
2007 Mar 16
1
Polymorphic find_or_create bug
Today I just spent 3 hours (and before a demo!) trying to figure out why my polymorphic association fields were breaking. Turns out someone else put in a patch for this 6 months ago. I''m not sure if its the same solution I''d use... I''d rather find_or_create attempt to use AssociationProxy#build if its available and only Base#new if we''re not on a proxy.
2006 Aug 02
1
ActiveRecord: find_or_create with has_and_belongs_to_many --
I am attempting to use find_or_create on a foreign table with a has_and_belongs_to_many relationship with my current table. I am doing the following: term = school.terms.find_or_create_by_code("FALL06") the queries in the log show the expected SELECT statement to query if there is a join table record between the school and term with code "FALL06": SELECT * FROM term INNER
2009 Oct 11
0
Nested Attributes and find_or_create
Hi, I''m using the new Nested Attributes to edit my models. It''s a complicated relationship between 5 different models which are subclassed from a ''Metadata'' model. They all have has_and_belongs_to_many relationships with the model I am trying to edit. Unfortunately when I add a new nested attribute, it creates a new row in the database. I need it to check up
2010 Jul 12
0
[Patch][Issue #5097] attributeless find_or_create/find_or_initialize
This patch relaxes DynamicFinderMatch to recognize find_or_create / find_or_initialize without a trailing _by_attribute_list. I''ve found this useful when the relevant attributes have already been built up through a chain of associations or named scopes. Please review, thank you! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2012 Feb 24
3
Devise generates Mailer by its own?
Rails 3.1.3 Hi. I''m a little confused with Devise and ActionMailer. It seems that Devise has its own way of sending mails through ActionMailer. Does it generate Mailer class when "rails g devise..." command is executed? Or do I need to do some special command in order to generate Mailer? I have certainly set up a devise User table but there is no Mailer class for it,
2007 Mar 28
7
Rails, REST and JSON
Hi everyone, I''m writing a lightweight AJAX application using Rails on the server side as a RESTful web service provider. I need the web service to support both JSON and XML I/O. Outputting data in XML and JSON is easy (using to_xml and to_json), and it''s also easy to do XML input as Rails does it for you automatically. Is it possible to somehow have the same automatic parsing
2004 Jul 09
3
Can R read data from stdin?
Is there anyway I can write a script which feed input datasource from stdin and let R process it (maybe frequency report) then output the report to stdout? I can't seem to find much info on documentation or FAQ on this topic. Thanks! Soichi Hayashi ********************************************************************** The information contained in this communication is confidential,
2007 Mar 30
0
Need help in running swfdec to watch youtube video
Hi, I am trying to use swfdec to watch youtube video. As an example, I want to watch this video from this page: http://www.youtube.com/watch?v=ot5DtISEceU >From the source of the above page, it has this link: var fo = new SWFObject("/player2.swf?video_id=ot5DtISEceU&l=227&t=OEgsToPDskIAT_WivMUj76nGfdhAFBKN&sk=CdlGIc1WbGevkdd3KWQVRQC", "movie_player",
2012 Oct 13
4
Database design, working but looking for better ways
Rails 3.1.3 Hi. I have designed the database used for my travel plan application. You should be able to look at the diagram in the link below, hopefully. https://cacoo.com/diagrams/biDSyxh8yzk2kIeg ("belongs_to" is omitted since it''s obvious) Basically, the application can list the destinations from a choice of the departure. Not mention that the departure_id (integer) and
2012 Nov 12
7
RSpec: controller POST create
Rails 3.1.3 rspec-rails (2.11.4) rspec 2.11.1 I am new to rspec. I don''t quite understand tests for POST create part. I have generated scaffold, and simultaneously it generated controller_spec.rb as well. it "assigns a newly created plan as @plan" do post :create, {:plan => valid_attributes}, valid_session assigns(:plan).should be_a(Plan)
2013 Jan 07
2
plot x-axis DateTime NOT evenly spaced
R-64 latest Hi. I am trying to plot a set of csv data, which looks like > head(interval) date inteval 1 2012-07-01 00:57:54 +0900 156 2 2012-07-01 01:07:41 +0900 587 3 2012-07-01 01:09:31 +0900 110 4 2012-07-01 01:18:42 +0900 551 5 2012-07-01 01:39:01 +0900 1219 6 2012-07-01 01:40:40 +0900 99 as you can see, more than one event happens each day,
2013 Apr 27
4
required field for one, optional for another
rails 3.2.11 My app has User model, its one of the fields is entrepreneur:boolean. So users have two types; one is normal users, the other is professional users. For normal users, only emails and usernames are required and other fields are optional. For professional users, in addition to above, addresses and real names are required. Is there any Ruby way to set the requirement depending on the
2013 Mar 11
3
take two columns from a set of lists
say I have a matrix and lists like x <- matrix(c(12.1, 3.44, 0.1, 3, 12, 33.1, 1.1, 23), nrow=2) x.list <- lapply(seq_len(nrow(x)), function(i) x[i,]) if I want a column of the matrix x, I write x[, 2] for example. But how can I do something similar for a set of lists, x.list, above? > x.list [[1]] [1] 12.1 0.1 12.0 1.1 [[2]] [1] 3.44 3.00 33.10 23.00 unlist(x.list)[,2] does
2004 Jul 21
3
Can R work on very large of data?
Hello.. I am pretty new for R, but if I understand it correctly, when R read data by doing something like "d <- read.table("/dev/stdin")", it read entire data first then start processing.. Is there anyway I can tweak R around so that it will start processing as data comes and not load everthing on memory at once? The reason for this is because we have a case where