Displaying 20 results from an estimated 4000 matches similar to: "creating and storing records in Ruby"
2006 May 17
2
Association data clobbering (foreign keys too?)
Can someone please confirm or correct the following statements?
If I have the following tables
create table as (id int, [...], b_id int);
create table bs (id int, [...], a_id int);
create table as_bs (a_id int, b_id int);
and the associations woould be defined like this
class A << ...
habtm :bs
belongs_to :b
end
so my Model A has a habtm collection of Bs *plus* a direct
2006 Jul 31
2
updating records in a many-to-many relationship
Im trying to establish relationships in a many to many table.
When I create a user, I do this to insert the different relationships
between the user and sports:
c.sports<<Sport.find_all_by_name(params[:sports])
where c is the user. The problem is, when I edit this user, and lets say
he adds a sport, I can''t use this because I get an error saying that
some records already
2006 Mar 15
1
push_with_attributes not inserting default values
I have a join table A_B with columns[a_id, b_id, c_data default 1,
d_data default 1].
If I do:
@aobj.bobjs.push_with_attributes(@bobj,{:c_data => 0})
I find that the row inserted, has d_data set to 0 and not the default
value specified in the database, which is 1. So I am having to
explicitly set it using :
@aobj.bobjs.push_with_attributes(@bobj,{:c_data => 0, :d_data => 1}).
Is this
2015 Aug 31
2
alloca combining, not (yet) possible ?
Hello
since my broad RFC request didn't catch any responses, let me get a bit
more into the nitty-gritty:
I tried to get llvm (3.7) to optimize superflous allocas away, but so
far I haven't figured out how. Is there no optimizer for this ? Should I
adorn something with some attributes ? As far as I can tell no, but I am
no llvm expert...
For what I want to do, i will probably have a
2015 Aug 31
2
alloca combining, not (yet) possible ?
Caldarale, Charles R schrieb:
> You have not provided us with the declaration for f(). Unless its argument is marked with the nocapture attribute, the compilation of g() cannot assume that f() has not retained a pointer to the x struct and is using it in the second call.
>
thanks a lot for the input. Yes, I forgot to that. The C function
declaration would have been
void f( struct a_b
2010 May 14
4
Tricky model situatione
I have two models Club and users. users are regular authenticated
users and some of them might create a club. A club can also have
members (essentially users) and there are attributes and models that
apply to member but not to users.
Here is what I have right now.
Club => belongs_to :user
User => has_many clubs (since a user can host multiple clubs).
Now how do I fit this member model
2015 Aug 28
2
RFC: alloca -- specify rounding factor for allocation (and more)
Hi
sorta piggybacking on the other thread. I am looking for some feedback
on how to implement the following idea in llvm.
The really short version of the idea is this:
* I want to alloca a field (record/struct), so that its size is an even
multiple of 64 bytes. [^1]
* This allocaed field will be exclusively used as an argument to functions
* llvm should be aware of the extra bytes and should
2017 Aug 04
2
Why is as.function() slower than eval(call("function"())?
(Apologies if this is better suited for R-help.)
On my system (macOS Sierra, late 2014 MacBook Pro; R 3.4.1, Homebrew build), I found that it is faster to construct a function using eval(call("function", ...)) than using as.function(list(...)). Example:
make_fn_1 <- function(a, b) eval(call("function", a, b), env = parent.frame())
make_fn_2 <- function(a, b)
2012 Feb 14
3
Wildcard for indexing?
Hi,
I'd like to know if it is possible to use wildcards * for indexing...
E.g. I have a vector of strings. Now I'd like to select all elements
which start with A_*? I'd also need to combine that with logical operators:
"Select all elements of a vector that start with A (A*) OR that start with B (B*)"
Probably that is quite easy. I looked into grep() which I think might
2006 Apr 20
7
Rails + postgres case insensitive searches.
Hello all
I am wondering how rails handles case sensitivity in databases. If I
do a Person.find_all_by_name("tim") in mysql I would expect to get
tim, TIm, and Tim. Do I only get tim in postgres?
How do other people deal with this? Do you resort to find_by_sql for
all your postgres queries to get case insensitive results?
2012 Oct 14
4
listing the files in a directory using regular expressions
Hi Experts,
This might be silly question that I am asking, but no way as I am new to
R.
I want to list the files in a directory using regular expression like
A_B*_C*.csv etc.
How to make this possible in R ?
I tried like this list.files(dir=".", pattern="A_B*_C*.csv") but this gives
no output, whereas list.files(.... pattern="*.csv") giving all the .csv
files in
2008 Jul 08
3
undefined method `name' ...........
Hi Community....
I''m new in this game, so this might be a easy question, but I have
done my google, without result, so I will try this....
I''m learning ROR, and I''m using Patrick Lens ''Ruby on Rails'' book.
(This is written for ror 1.x - and I''m using NetBeans 6.1 - ror 2.x -
this might be the problem...)
But...
I have made this
2006 Feb 28
4
multiple keys table
probablly a newbie question:
Rails does not support a table with multiple keys ???
it seems that the ActiveRecord set_primary_key method can only set the
column name... (hope i''m wrong there)
example:
table A - P.K id, string name
table B - P.K id, string name
table C - P.K a_id and b_id, both are also foreign keys.
Thanks,
Amir.
--
Posted via http://www.ruby-forum.com/.
2006 Mar 13
3
HABTM: two habtm''s between the same two tables
Imagine I want to track people, and the clubs that they belong to.
table people with columns person_id, person_name
table clubs with columns club_id, club_name
And I have the association table:
table clubs_people with columns person_id, club_id
Now I know how to do this habtm between the two, in order to associate
people with clubs that they belong to.
However my application also needs a
2007 Feb 13
1
observe_field and select box
Hi everyone,
I am a newbee in RoR and i could use some help. I have a select box
populated by:
<select name = "test_company" id = "test_company">
<option selected value=test.company.to_s>Create New </option>
<%= options_for_select Company.find(:all,
:conditions => ["name =?", test.company],
:order => "id asc").collect{|c|
2008 Mar 07
2
Trouble using RESTful helper
Hi,
I am trying to get into this REST thing, I have a nested resource
whith the following route:
ActionController::Routing::Routes.draw do |map|
map.resources :members
map.resources :clubs do |club|
club.resources :members
end
map.connect '':controller/:action/:id''
map.connect '':controller/:action/:id.:format''
end
Everything worked ok for this
2008 Jul 04
2
How to make WHERE foo_id IN () query?
Hi,
There are 3 models:
A has_many :Cs
B has_many :Cs
C belongs_to A and B
I got a single object of A and an array of B objects. How can I get
all Cs that have a_id equal to object A.id *and* b_id that belongs to
an object in Bs array?
Regards
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2008 Apr 19
1
update and update_attribute woes
i can not get update to work via controller/server.
it works via console ???
this is what i get when i run it
Club Load (0.005893) SELECT * FROM clubs WHERE (clubs."id" = 3)
SQL (0.000570) BEGIN
SQL (0.000454) COMMIT
club.update_attributes(:state => "CA")
or
Club.update(3, :state => "CA")
what am i overlooking?
2017 Apr 09
2
[Bug] FTS invalid address parsing
Hi,
i found another bug in FTS while parsing
quoted-printable/base64-encoded sender's name inside 'From' header
(again, i was figuring out why some of messages cannot be searched).
Header: From: =?UTF-8?Q?A=2CB?= <test at example.com>
Data send to Solr by Dovecot: <field name="from">A@, B
&lt;test at example.com&gt;</field>
Header:
2010 Oct 26
4
divide column in a dataframe based on a character
Hello,
If I have a dataframe:
example(data.frame)
zz<-c("aa_bb","bb_cc","cc_dd","dd_ee","ee_ff","ff_gg","gg_hh","ii_jj","jj_kk","kk_ll")
ddd <- cbind(dd, group = zz)
and I want to divide the column named group by the "_", how would I do this?
so instead of the first row being
x