similar to: sort-weirdness - active record issue?

Displaying 20 results from an estimated 9000 matches similar to: "sort-weirdness - active record issue?"

2006 Jul 13
2
having a problem with acts_as_state_machine
Hi all: Below is s a dump from script/console in development env. Am I not supposed to be able to find the record later and use the state machine functionality, or have I missed something? Thanks Forrest ---------------------------- >> ts2 = TalkSession.create( :person_id => 2, :pattern_id => 2) => #<TalkSession:0x35811f0 @attributes={"pattern_id"=>2,
2006 Apr 28
2
Active Record save doesn''t save! (more detail - is this a bug?)
I got it to work by changing scheduled_end_date= nil to self.scheduled_end_date= nil. I believe these statements should be equivilent. I don''t know Ruby/Rails well enough to know when, if or why that should matter. Can someone educate me please? I want to believe this framework is ready for production work, but silently dropping data is a very big problem. I expect that I''ve
2006 Apr 28
7
Active Record save doesn''t save! (or throw an exception)
PLEASE help me - this is making me insane. Can anyone suggest any reasons for this behavior? It occured previously, then went away and is now back. In Task.rb (where task is an active record subclass) def clear_schedule puts "clearing schedule for task" scheduled_end_date= nil #reset the scheduled end date save halt.
2006 May 26
3
Breakdowns in has_many abstraction
I discovered an interesting aspect of has_many behavior that I''m struggling to work around. I''m not sure if I''m doing something wrong, or if it''s a legitimate bug, or if it''s an inherent part of Rails that I just have to learn to deal with. It boils down to these two problems: - changes in collection objects (i.e. models that belong_to a container
2006 Jun 08
4
datetime fixture format for Mysql 5.0
Hi All: I develop on several machines, most have Mysql 4.* and one has Mysql 5.0. On 4.*, the following erb for a fixture works fine: updated_at: <%= 1.days.ago.to_s:db%> But fails on 5.0. I had a similar deal when I had date fixtures, and switched forrmats so that both 4.* and 5.0 were happy. is there to_s:db_works_for_mysql_50() ? or similar? Thanks Forrest
2006 Jan 17
4
find_by_sql column ordering defect?
Hello. I have a program that accesses a metadata (translation) table for column names as well as the ordering of columns for a specific model. Also in there is a collection of bool options such as column_visible_on_form, column_visible_on_screen_quicklist etc. The idea is that our customer can specify to a certain extent how their layout/user interface will appear. To accomplish this, I use
2006 Mar 17
4
deleting from hash question
I''m a ruby newbie and have what is probably a relatively simple problem I''m trying to solve. Say that I created a hash: TASKS = { "homework" => "Do Your Homework", "chores" => "Your Have Chores", "exercise" => "Don''t Forget to Exercise" } and then I had an Assignment model with: def
2012 Nov 07
1
Newbie question : selecting subset of a Matrix
I have a matrix, I would like to use it like I use where query on an SQL table Let's say my matrix is > wok who task 1 joe task1 2 joe task2 3 joe task3 4 jack task1 5 jack task2 I want to extract a matrix that contains only rows where who = "joe" and task != "task2" The result would be the following matrix 1 joe task1 2 joe task3 How can I do
2006 Jun 23
3
form_remote_tag is not passing form params
I''ve searched and searched and searched again, and I cannot find any help with this problem. There''s an identical problem on this forum, but it was never resolved. I''ll try to re-open the subject with a bit more information. Problem: The form_remote_tag() method in my "list" view is not passing the params[] hash of the values stored within my form.
2006 Jan 01
7
Can''t get select helper to populate dropdown w/default value
Guys, I searched this forum and found plenty of people having this problem, but I didn''t see any definitive solution. Usings Rails 1.0. When I edit an existing record, I can''t get the basic "select" helper to display the current value contained in the field of the record. All of my other (text) fields populate correctly with current field values. There appears
2011 Apr 10
1
Help with basic loop
The loop is correct, you just need to make sure that your result is computed and stored as the n-th element that is returned by the loop. Pick up any manual of R, and looping will be explained there. Also, I would recommend that you draw a random number for every iteration of the loop. Defining the random vectors outside the loop make sense to me only if they are the same length as n.
2008 Oct 02
4
namespaces
I'd like to control my namespace thoroughly, separated by task. Is there a way, in R session, to introduce namespaces for tasks dynamically and switch them as needed? Or, is there a combination of load/save workspace steps which can facilitate this? Cheers, Alexy
2009 Feb 27
4
Optimize for loop / find last record for each person
I want to find the last record for each person_id in a data frame (from a SQL database) ordered by date. Is there a better way than this for loop? for (i in 2:length(history[,1])) { if (history[i, "person_id"] == history[i - 1, "person_id"]) history[i, "order"] = history[i - 1, "order"] + 1 # same person else history[i,
2007 May 16
5
drop a letter
hello, how can I do to drop C from this character "C325" ? _____________________________________________________________________________ [[alternative HTML version deleted]]
2006 Jul 05
2
Serialized object behaves weird
Hi! I got a class named EinsatzFilter which I serialized to session. Before saving to session it works afterwards I keep getting the message: "undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from ActiveRecord::Base inherited class. Code: class EinsatzFilter include ApplicationHelper attr_reader :personen, :monat, :projekte, :kunde
2006 Jan 09
3
Design Question
I am sure some of you can give me an insight into this. This is more towards the database design for the scenario below: Say for example, I have a person table and this person can have different address types. One could be Home and the other could be say Office. Should be model this Table people id fname lname Table addresses id person_id addr1 addr2 .... or Table people id fname lname
2006 Apr 17
1
database design Q
I am in the middle of setting up mysql database for my RoR application. and here is some questions in my mind hope you can help. 1. this is a photoblog story telling like system, where people can creat their own groups the database tables are: people, groups, articls, pictures People to Groups are many-to-many relationships People to Articles are one-to-many Group to Articles are one-to-many
2010 Nov 02
7
Testing attr_accessible (and/or attr_protected)
I''ve been puzzling over how to test that attr_accessible has been set for the correct columns; but the tests I''ve come up with so far seem to fail to fail when I expect. I came across this old message from this list: http://www.mail-archive.com/rspec-users at rubyforge.org/msg01570.html Which seemed like a plausible example, but my attempt (modeled on the example)
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
2006 Oct 02
2
when to use find_by_sql
I have a bunch of queries to compute some counters, like find_by_sql(<<-SQL SELECT p.*, c.nfavourites FROM people p, ( SELECT fp.person_id, COUNT(fp.user_id) as nfavourites FROM favourite_people fp, users u WHERE fp.user_id = u.id AND u.cluster = ''#{in_cluster_of_user.cluster}'' GROUP BY fp.person_id ) as c WHERE