Displaying 20 results from an estimated 500 matches similar to: "avoiding timconsuming for loop renaming identifiers"
2006 Jul 31
2
Updating a belongs_to foreign key leaves the old association object available
Perhaps this is intentional, but it seems unlikely:
class Person < ActiveRecord::Base
belongs_to :school
end
p = Person.find(:first)
p.school # nil
p.school_id = School.find_by_name(''High School'').id
p.school.name # High School
p.school_id = School.find_by_name(''Primary School'').id
p.school.name # High School <= Shouldn''t this be Primary
2008 May 25
2
record will absolutely not save! so weird, please help.
I have a weird problem going on. All of sudden, records for a certain
model will not save with #save Please take a look at this:
>> p = Payment.new(:payment_reason_id => 1, :payment_method_id => 1, :date => Date.today, :amount => ''5.00'', :payable => Student.find(608))
=> #<Payment id: nil, school_id: nil, payment_reason_id: 1,
payment_method_id: 1,
2006 Feb 11
2
Migrations and Unintialized Constants Error
I am running into a problem with two of my tables and the
"uninitialized constant" error when using migration.
I get the "uninitialized constant Note" when running the following
code in my migration file:
create_table :notes do |t|
t.column :id, :integer
t.column :noteshare_id, :integer
t.column :title, :string
t.column :covered, :string
2008 Apr 07
5
Associations errors
undefined method `each'' for 0:Fixnum
at line
@school = School.find_by_title(params[:school_id].gsub(''-'', " "))
for team in @school.teams
........
end
@school does exist cause i tried with .find(:first) and it gave the
same error.
Also I''m getting
undefined method `reject'' for #<Game:0x24ca1c4>
From @home.game_ids = @game
2006 Mar 29
3
socket for mysql
I have mysql running on a different machine. I''ve editted database.yml,
here''s the entry
development:
adapter: mysql
database: cookbook
username: root
password: mypassword
host: posta.rmasonfamily.info
test:
adapter: mysql
database: cookbook
username: root
password: mypassword
host: posta.rmasonfamily.info
production:
adapter: mysql
database: cookbook
2010 Oct 20
3
Plot help
Dear List,
I am relatively new to R and am trying to create more attractive plots than excel can manage!
I have looked through the various programmes ggplot, lattice, hmisc etc but my case seems to be not metnioned, maybe it is but i have not noticed - if this is the case i apologise.
2006 Mar 27
1
Best way about doing this?
Hi All,
I''m super a super ruby nuby, so bare with me. I am working on a small
app that has a particular form that I am having a rough time figuring
out the best to way to handle.
Basically here it is, each school has one or more classrooms, and each
classroom can have one or more teachers.
Here''s what I am trying to do (edit a school):
- click on a link to edit a School
-
2009 Feb 12
4
routes
I''m trying to figure this.
in my schools controller i want to do this....
# implement a create action to create just the review for the
School...
def create_review_for_a_school
@review = Review.new
@school = School.find(params[:school_id])
@review = @school.reviews.build(params[:review])
if @review.save # The creation worked....do this
flash[:notice] =
2007 May 28
5
validates_uniqueness_of does not pass unit test
I am doing some very very basic unit testing. If I take away the
uniqueness validation, the tests pass. Could this be a bug in Edge
Rails?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2006 Jul 27
0
Controllers, Models, and Validations...
Hello,
After listening to DHH''s 2006 RailsConf keynote, I decided to take a
leap on my current application and do a little more re-organizing to
make it more CRUD-based. As such, I ended up changing some things
around to get this (simplified):
User has_many :enrollments, :conditions => ''status > 0''
User has_many :schools, :through => :enrollments
User has_many
2009 Apr 06
3
Sangoma and BT single lines
Hi, got a Sangoma A200 with a bunch of extension cards and having real
problems getting it to deal with a normal single BT line
Symptoms are that incoming calls are fine. Outgoing calls ring the far
end, BUT asterisk never sees that the call is answered (ie no message in
the logs files saying so), as a result the remove end can hear the PBX
side talking, but there is no audio back from the
2008 Apr 11
2
Validating an ActiveRecord object and its has_many :through associations
Considering an object with several has_many :through => associations,
what is the ''best'' way to handle validations?
As an example:
class Student < ActiveRecord::Base
# some attrbutes like
# :name
# :grade
# relationships
has_many :students_assignment, :dependent => :destroy
has_many :assignments, :through => :students_assignment
has_many
2009 Feb 09
3
rendering original view
def create
# next statement is original and is removed
# @review = Review.new(params[:review])
@school = School.find(params[:school_id])
# @review = @school.reviews.create!(params[:review])
@review = @school.reviews.build(params[:review])
respond_to do |format|
if @review.save
flash[:notice] = ''Review was successfully created.''
#
2007 Aug 07
1
R2WinBUGS results not different with different runs
Hi All
I dont know if anyone else has noticed the same thing, but with 2 subsequent
runs of the same syntax, I am getting exactly the same results. I was expecting
that results differ slighlty, say in the 4th or 5th decimal place.
Is this a specialty with R2WinBUGS? Does it have something to do with the seed
value? Isnt the seed value reset everytime I restart winbugs?
Thanks Toby
2007 Mar 09
2
piecing together statements (macro?)
Hi All
I am pretty new to R but saw stata and sas's macro facilities and am looking for
how such things work in R.
I am trying to piece together a series of statements:
n = 5 #want to have it dynamic with respect to n
for (j in 1:n) {
eval(paste("x", j, "=x[", j, "]", sep=""))
}
I want the created statements 'x1=x[1]' immediately executed
2007 Jun 01
2
how to specify starting values in varIdent() of lme()
I was reading the help but just did not get how to specify starting values for
varIdent() of the lme() function, although I managed to do it for corSymm().
Do I specify the values just as they are printed out in an output, like c(1,
1.3473, 1.0195). Or do I need to take the residual and multiply it with these
like c(0.2235, 0.2235*1.3473, 0.2235*1.0195)
or any other form that I dont know of?
2006 Jun 03
8
confused about ActiveRecord relationships
I am very confused about where to put the belongs_to and the has_one
(and other relationship identifiers). I have read the RDoc and the
agile book many times about this and I think i still see it backwards.
Let me outline my app so you have an understanding...
I have 2 tables:
Schools { id, school_name, address_id }
and
Addresses { street1, street2, city, state, zip, country }
*** this
2007 May 23
2
saving datafreame object problem
Do I miss here something?
dtaa =
read.table("http://www.ats.ucla.edu/stat/mplus/examples/ma_snijders/mlbook1.dat",
sep=",")
head(dtaa) # shows the data as it should be
save(dtaa,"dtaa",file="c:/dtaa")
d = load("c:/dtaa")
head(d) # all data is lost, it only shows [1] "dtaa" "dtaa"
Thanks for your hint on this.
2007 Oct 29
1
lm design matrix bug?
Hi All
Maybe I dont understand it, but I would have expected that the design matrix has
as many rows as there were observations available to fit the model.
Below a small artificial dataset created, then one model fitted and the design
matrix outputted, having 27 rows. Then I delete 6 obs, and fit the model on
these 21 obs, but the design matrix that comes out has 26 rows?
Thanks for your
2007 May 21
1
can I get same results using lme and gls?
Hi All
I was wondering how to get the same results with gls and lme. In my lme, the
design matrix for the random effects is (should be) a identity matrix and
therefore G should add up with R to produce the R matrix that gls would report
(V=ZGZ'+R). Added complexity is that I have 3 levels, so I have R, G and say H
(V=WHW'+ZGZ'+R). The lme is giving me the correct results, I am