Displaying 20 results from an estimated 2000 matches similar to: "find_all_by and :order"
2008 Feb 07
1
ActiveRecord 'find_or_initialize_by' dynamic finder bug? Ignoring conditions.
Hello all,
I just ran into something that I think is a bug, and I would like to
confirm with the core team whether this is expected/desired behavior
or if this is a bug that I should file and develop failing tests for
(I doubt I have the active record method_missing fu to actually patch
it).
Test Scenario:
I would like to find or initialize a new user and base the find on the
users email
2005 Mar 10
10
Some Basic Questions
Sorry I can''t access IRC from work so I hope you don''t mind me asking my newbie
questions here:
1) I have the following code:
@post = Post.find(@params[''id''])
@comments = Comment.find_all "post_id = #@params[''id'']", "created_on ASC"
And I am have problems with the second line. I want to pass the id from my post
to the
2008 Mar 04
6
find_all_by deprecated?
Is find_all_by deprecated and/or find_first_by for 2.0.2? If not,
what is actually deprecated? just find_all(..) and find_first()?
Thanks for clearing this up.
--~--~---------~--~----~------------~-------~--~----~
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
2009 Jul 16
12
Find_all_by and find(:all) to only select certain values for a selection box
So....let''s have a look if I understood the issue:
-Find_all_by is actually the same like Find(:all), however Find_all_by
is much shorter and less complicated than the syntax of Find(:all)
-So in my CONTROLLER it says @files = find(:all) however I don''t want
to see all files displayed in my selection box, because I only want to
see the foles whose mandant_id is the same like
2006 Apr 11
4
find(params[:id]) question
Admin Controller -
def show
@wizard = Wizard.find(params[:id])
end
View -
<td><%= link_to ''Show'', :action => ''show'', :id => wizard %></td>
URL -
http://localhost:3000/admin/show/1
I want user_name (one of the columns in the database) instead of the id
to show
For example:
2008 Feb 08
4
x-post : find_or_initialize_by ActiveRecord bug? Ignores :conditions
Hello, I posted this on the rails talk group but received no
response. Perhaps someone on this list could weigh in on whether this
is expected/desired behavior or a bug that I should file and develop
failing tests for
(I doubt I have the active record method_missing fu to actually patch
it).
Test Scenario:
I would like to find or initialize a new user and base the find on the
users email
2006 Apr 24
8
Application Design
I have a question about how to implement a design in Rails. I will try to make this as easy to follow as possible. First, let''s say that I have an ''Orders'' table that has different statuses. The 3 statuses that I want to track are ''Submitted'', ''Approved'', and ''Purchased''.
I also have 3 users of this application.
2005 Mar 09
21
Converting time retrieved from MySQL
I''m having a problem converting a date retrieved from my MySQL database
and I''m hoping someone can help.
MySQL stores the date/time as this:
2005-03-08 17:00:34.0
and according to my Pickaxe book Ruby stores times as "the number of
seconds and microseconds since [...] January 1, 1970". All well and good.
Unfortunately, RoR is converting my date to this:
2005 Dec 19
3
created_on, created_at defaulting to 2000/01/01 00:00:00
Hello all,
Rails 1.0.0
created_on is being set to 2000/01/01 00:00:00
Any ideas on this ?
Thanks!
Schema is
create table user_login_history (
id int identity(1,1) not null,
user_id int not null,
created_on datetime default(getdate()) not null,
created_at datetime default(getdate()) not null,
updated_on datetime default(getdate()) not null,
constraint pk_user_login_history primary key clustered
2006 Apr 14
4
Newbie stuff (.new method)
Hi-
Ruby 1.8.2 Rails 1.1
so I''m trying to build my first rails app and I''m trying to understand
how the helper methods work. For instance .new & .save . For instance,
I''ve created a table of Objects, and generated a scaffold. I see that
in the controller, there are calls to Object.new and Object.save. I''m
assuming that these are methods inherited
2006 Apr 20
5
Noobie problems with helper
I have the following helper method in application_helper.rb:
def format_date(date)
day = to_s(date.day)
month = to_s(date.month)
time = to_s(date.time)
date = day + "/" + month + " - " + time
return date
end
I am trying to call this method in a view like this:
<%= format_date(bounty.created_on) %>
create_on is a timestamp in mysql. I am
2004 Feb 04
5
Date Time Conversion problems...
At one time (version 1.7), the code below used to work for converting and
extracting based on the Date Time. In version 1.8.1, something changed I
know, but I cannot for the life of me figure out what...
Data:
UserName,RequestDate,PO,OrderDate,ExpDelivDate,Vendor,Total
"Woody, Jim",12/19/2002,AP15063,1/7/2003,2/10/2003,Ames ,8570
"Harrold,
2005 Dec 23
4
OO model style: inheritance
Hi everybody
I am totally new to rails and I am trying to start a
tiny project to get familiar with rails. But I already
got my first problem and I would be happy if somebody
could point me in the best and cleanest direction.
I am trying to develop a small gallery app. Since I
would like to add more features in future I am trying
to design a clean OO architecture of my models:
The base object
2006 Jan 26
9
Problem with schema_db_import on Site5?
Hello,
I am trying to put my rails app on a host .So I presume the method to do
this is to first do
rake db_schema_dump and then copy it to the host and do
rake db_schema_import.
I use mySQL Ver 14.7 Distrib 4.1.14, for pc-linux-gnu (i686) using readline
4.3
** Invoke db_schema_import (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db_schema_import
rake
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
2018 Nov 30
8
[PATCH RFC 00/15] Zero ****s, hugload of hugs <3
On Fri, 30 Nov 2018, Kees Cook wrote:
>On Fri, Nov 30, 2018 at 11:27 AM Jarkko Sakkinen
><jarkko.sakkinen at linux.intel.com> wrote:
>>
>> In order to comply with the CoC, replace **** with a hug.
I hope this is some kind of joke. How would anyone get offended by reading
technical comments? This is all beyond me...
Thanks,
Davidlohr
2006 Jun 13
2
four days on rails - nil object when you didnt expect it
Hi all,
Im trying to get my head around rails and to help along Im working
through "four days on rails" as this seems to give a good real world
example with multiple tables and relationships (the main thing I cant
work out!)
Ive got stuck. Some help would be really good here.
The controller has this code:
def list
@category_pages, @categories = paginate(:category, :per_page =>
2006 May 03
6
ActiveRecord and Lost Connection
This isnt totally a rails question; I am using ActiveRecord for storing
some simple values into a database. My problem; I keep gettign MySQL
Errors. On the Win32 machine it was off and on. Now on the linux
machine (ubuntu) I can'' t connect at all. I have all the password
settings correct.
My only thought, I am working with Threads and thought that might cause
the issue, but I
2006 Jan 06
4
"Selecting" a calculated row / Using :select in the paginate method
Hi,
I was trying to use the :select parameter to select a calculated row,
but it appears that the parameter is not picked up by the paginate method.
I want to add the following to the select statement:
timediff(now(), created_on) as age
So I tried:
@story_pages, @stories = paginate :stories, {:per_page => 10, :include
=> ''user'', :select =>
2007 Dec 03
5
spec for model_id should eql
Hello,
I''m confused why the spec described below is failing. Other simple
comparison specs are passing fine for the same model. The code is working
accordingly when I test it through the console, I''m just having difficulty
getting this spec to work. Any pointers would be appreciated.
Failure message:
''Address fetch and geocode should extract department and write to