Displaying 20 results from an estimated 500 matches similar to: "Write/Display AR query as Grouped Results?"
2011 Feb 25
1
Small enhancement for CMD check
It would be nice if the 00check.log file also included this part of the
output:
Running ?bladder.R?
Comparing ?bladder.Rout? to ?bladder.Rout.save? ... OK
Running ?book1.R?
Comparing ?book1.Rout? to ?book1.Rout.save? ... OK
Running ?book2.R?
Comparing ?book2.Rout? to ?book2.Rout.save? ... OK
etc.
The survival package has enough test scripts that it exceeds my
terminal's scroll
2006 Jun 27
4
Not Active Record Model Validation
I have a problem with ruby on rails validation
total_book_toy.rhtml
================
<%= text_field ''book1'', ''title1'' %>
<%= text_field ''book2'', ''title2'' %>
I want to validate these text_field so user can''t insert same title.
However, I was stuck how to do it.
Or maybe you have another way how to do it.
2008 Feb 26
3
using eval-parse-paste in a loop
R-helpers
I have 120 small Excel sheets to read and I am using
library(xlsReadWrite): one example below.
I had hoped to read sheets by looping over a list of numbers in their
name (eg Book1.xls, Book2.xls, etc).
I thought I had seen examples which used eval-parse-paste in this way.
However, I have not been able to get it to work..
1. is this a feasible approach?
2. if not
2006 May 31
7
Getting 22 elements
Hello,
I''ve done
===
class HomeController < ApplicationController
def index
@country = Country.find(:all, :include => "cities")
end
end
===
And rhtml is:
===
<% @country.each do |country| %>
<h1><%= country.name %></h1>
<% country.cities.each do |city| %>
- <%= link_to city.name, :action =>
2011 Jan 20
2
Regression Testing
I'm new to R and some what new to the world of stats. I got frustrated
with excel and found R. Enough of that already.
I'm trying to test and correct for Heteroskedasticity
I have data in a csv file that I load and store in a dataframe.
> ds <- read.csv("book2.csv")
> df <- data.frame(ds)
I then preform a OLS regression:
> lmfit <- lm(df$y~df$x)
To
2012 Aug 17
4
Appending many different and separate Excel files using R
Dear all,
Good day!
I have a problem in reading Excel files in R and appending them to each other. Suppose we have several Excel files in a directory with headers and want to use R to append them in a single file with an additional variable in the final file indicating from which files the data come from.
As I have many Excel files and their sizes are very big I should write a loop in R to do
2006 Jul 20
11
3 columns
Hi all,
Not really sure what to put in the title so hope people still open this!
What I want to do is produce something like this
Col1 Col2 Col3
data1 data2 data3
data4 data5 data6
data7 data8 data9
data.. data.. data..
data.. data.. data..
data-n data-n+1 data-n+2
I can get the data back from my db
2008 Jan 01
7
in_vertical_groups_of
Hi all,
Here''s another contribution for anyone interested.
In Railscast episode 28, Ryan Bates showed us in_groups_of which
allows you to group array members such as
>> list = [1, 2, 3, 4, 5, 6, 7]
=> [1, 2, 3, 4, 5, 6, 7]
>> list.in_groups_of(3)
=> [[1, 2, 3], [4, 5, 6], [7, nil, nil]]
This allows you to iterate over the groups and, for example, display
a list
2008 Jul 06
1
ActionView::Base.field_error_proc not getting an error field
In my User form I have standard field to get user record attributes
(first_name, last_name and email)
I also have a select drop_down to choose a role from an array
first_name, last_name and email are user record attributes, but I
defined the role name as a virtual attribute
validates_presence_of :email, :last_name
attr_accessor :role_name
validates_presence_of :role_name, :if
=>
2009 May 12
4
has_many :through and scopes: how to mutate the set of associated objects?
I have a model layer containing Movie, Person, Role, and RoleType,
making it possible to express facts such as "Clint Easterbunny is
director of the movie Gran Milano".
The relevant model and associations look like this
class Movie < ActiveRecord::Base
has_many :roles, :include => :role_type, :dependent => :destroy
has_many :participants, :through => :roles, :source
2006 Jul 06
0
Paging with multiple tables/models
I''m looking for a smooth way to implement paging over a combination of
two tables.
My application tracks which books and movies you have borrowed from
me. For reasons that make sense elsewhere in the application, these
are seperated out into two tables: book_borrowers and movie_borrowers
and therefore 2 different activerec objects: BookBorrower and
MovieBorrower
This particular screen
2008 May 21
8
before_filter with multiple roles
I have multiple roles in my application.
Now I want to block a method for all users except the administrator and
a manager.
When I do this:
before_filter (:check_administrator_role), :only => [:administration]
before_filter (:check_taskmanager_role), :only => [:administration]
The user must have both roles. How can I change that to an "OR"
combination?
--
Posted via
2009 May 24
6
belongs_to not saving foreign key
Under Rails 2.3.2 using a completely brand new project, I have 2
models:
class Author < ActiveRecord::Base
# name:string
end
class Book < ActiveRecord::Base
# title:string
belongs_to :author # author_id
end
And a simple test where i create a Book with an Author using the
belongs_to and then update the foreign key directly:
require ''test_helper''
class BookTest
2005 Sep 28
1
Errors in odbcConnectExcel()
Dear R-help
I would like to read Excel Spreadsheets using
odbcConnectExcel()
in RODBC, but data in the first row can not be read.
For example, I tried to read Excel file 'Book1.xls' in the
current Work Directory with the following data
(Range("A1:B5") in Excel),
1 19
2 27
3 61
4 76
5 98
My commands and the result are as follows.
> library(RODBC)
> Book1 <-
2006 Mar 31
2
A.R. Associations problem
Hello,
I''m learning A.R Associations by creating a simple forum that consists
of 3 tables: ahuthors, topics and posts. This is the schema:
class AddAuthorAndTopicAndPostTables < ActiveRecord::Migration
def self.up
create_table :authors do |t|
t.column :username, :string
t.column :email, :string
t.column :created_on, :datetime
end
create_table
2009 May 27
4
Scaffolding Results Format
Hi Everyone,
I built a scaffold and I''m having trouble getting results properly
formatted. (I need to get the data into multiple columns instead of just
one big column) I can''t get all of my CSS to work properly in
scaffold.css, layout/books.rhtml, or the books/index.rhtml.erb Anyways,
maybe you have a suggestion.
Default view (127.0.0.1:3000/books)
Title Abstract
2005 Apr 20
4
Error in tutorial or sintax changed?
Hi,
In this tutorial
http://wiki.rubyonrails.com/rails/show/HowtoUseJoinsWithFindAll
it sad:
sql =<<SQL
SELECT articles.*, authors.name AS author_name
FROM articles
LEFT JOIN authors ON author_id = authors.id
SQL
and this return
*app/controllers/media_controller.rb:366: can''t find string "SQL"
anywhere before EOF*
what is wrong? the tutorial or ruby changed?
please,
2006 May 03
2
grouped output
hello,
Suppose I have a table that looks like this:
center name email
Health Jon jon@test.com
Health Bob bob@test.com
Admin Jane jan@test.com
Admin Jill jill@test.com
I would like the output to look like this:
Health
Jon jon@test.com
Bob bob@test.com
Admin
Jane jan@test.com
Jill jill@test.com
when i using cold fusion, this was easy via a tag called cfoutput.
when i was using java, this was
2006 Jun 13
6
Dead horse: validates_associated
Regarding validates_associated...
Let''s say I have:
article belongs_to author
But for whatever reason, I want an article to also be written
anonymously and therefore not require an author. Then I have:
Article:
belongs_to :author
validates_associated :author
But I DON''T have validates_presence_of. What I want to do is validate
that an author is valid --if it is
2006 Jan 22
11
ActiveRecord find
Suppose I have three tables - authors, posts and topics.
Every post have a topic and every topic has an author, so I have
posts.topic_id and topic.author_id. When the author is guest (not
registered), author_id is nil.
I need to find all the posts (in one query) where every post have all
the information of the topic and the auther, so if p is one of those
posts I could get the name of the