similar to: ActiveRecord: Exclude some columns while fetching

Displaying 20 results from an estimated 10000 matches similar to: "ActiveRecord: Exclude some columns while fetching"

2005 Aug 20
6
How to find() only selected columns ?
Hello, I don''t know anything about Rails optimization, however... is it possible to select only specified columns in order to tell Active Record not to load everything from the table as does @items = Item.find(:all) ? Thank you
2006 Jan 24
4
Laszlo on Rails, Flash GUI
Ruby Forum Search did not work, and I did not find any postings about http://laszlo-plugin.rubyforge.org/. OpenLaszlo is a framework handling the GUI part, or the V in MVC. See http://www.laszlosystems.com/lps/laszlo-in-ten-minutes/ for info about Laszlo itself. My question is, does anybody have experience with this framework, especially combined with Rails? Or, could I get some of the best
2005 Nov 22
11
Building a conditions clause (for find) of multiple optional params?
I want to be able to find items according to various params - category_id, member_id, type_id, rating, etc. What I have now is something like: if(@params[''category_id'']) @items=Item.find(:all, :conditions=>["category_id=?", @params[''category_id'']) elsif(@params[''category_id''] and @params[''member_id''])
2010 Nov 11
5
ActiveRecord query
I have these sql code in postgresql "SELECT * from convenios where id NOT IN (SELECT convenio_id from solicituds where usuario_id=?" but don''t find a way of used it in rails except find_by_sql. There is a another way?? class Usuario < ActiveRecord::Base belongs_to :persona has_many :solicituds, :dependent => :destroy has_many :convenios, :through =>
2006 Jan 24
1
Search => Application error (Rails)
This is the reply when searching. Christer -- Posted via http://www.ruby-forum.com/.
2006 Apr 20
4
ActiveRecord: Many-to-Many problem
I am trying to make many-to-may relationship on classes Section and Content. Both Content and Section has: has_and_belongs_to_many :contents and has_and_belongs_to_many :sections and I have an exception when trying to access model properties: "undefined method `add_contents'' for #<Section:0xb745c514>" def add_content_entry @section = Section.find(params[:section_id])
2005 Nov 24
1
Log question
development.log contains quite a few SELECTS on system tables like COLUMNS. Wouldn''t it be more efficient to cache this info? I''m also wondering about strings like "[4;35;1m". What''s their purpose and is it possible to get rid of them? They look like screen coordinates and makes no sense in a text file. Christer Processing ReportController#create (for
2005 Dec 29
1
Resolving ambiguous columns during a join
I am working with an existing schema and thus limited in how much I can bend my existing column names. I have a table Users, and a table ForumUsers, for which I have a "has_one" relationship - a user has_one forumuser. When I look at my user records I wish to include some information from forumuser: @users = User.find :all, :include => :forum_user, :order =>
2006 Mar 02
3
Left Joins with Rails?
Everyone, I have two tables (assuming their most logical types): apartments id address bedrooms bathrooms googlemaps_id googlemaps id url the models: class Apartment < ActiveRecord::Base has_one :googlemap end class Googlemap < ActiveRecord::Base belongs_to :listing end I would like to find_all by searching the attributes in apartment, and also return the google map
2005 Nov 25
4
Set default order for find(:all) in a model
Hi everyone Is there a way that I can get the find(:all) method to return in a specified order, without including the :order argument every time? Guess I just don''t like typing... Cheers _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
2006 Aug 16
5
Rails theory question, where to put a join query
The is something I wrestle with a bit when I construct joined queries.. Perhaps some experienced insight will straighten this out for me. Say you have two tables with two models, ''authors'' and ''posts''. an author has_many posts, a post has_one author. You need methods to do the following queries: find_author(postid) find_posts(authorid) And you are doing a
2006 Mar 04
10
Help setting up relationships needed
This is a bit of a long question, but to those of you with some experience, it should be fairly simple I think. I have a notes page that should list all notes the user has entered for all books chronologically like this. Book One: This is the note. Book Four: This is the note. Book One: A different note, entered later. Right now my models are: User has_many :books Book has_many
2004 Feb 05
1
Norton personal firewall tells me that bad TCP packets are received
This is some of the messages I get: TCP non-syn/non-ack packet on invalid connection. Packet has been dropped TCP Source Port: http(80) TCP Destination Port: 2595 TCP Message Flags: 0x00000019 The TCP message Flags varies. I''ve seen 0x00000011, 0x00000010, 0x00000018, 0x00000004, 0x00000014 and 0x00000019. Intrusion: Invalid TCP Flags TCP Source Port: 6881 TCP Destination Port: 4307
2006 Apr 18
6
Postgresql and ActiveRecords problems
Hi all. I have a problem with postgresql PK columns and ActiveRecord. The error is: PGError: ERROR: null value in column "item_id" violates not-null. Ok, it''s wrong to insert NULL into PK columns, but rails doing it. How to fix? So sad..
2006 Jun 16
3
ActiveRecord, using sql functions for some attributes
Hi. I need to use functions INET_ATON, INET_NTOA for IP address retrieving. Is it possible to make this transparently (without custom SQL for saving, updating and retrieving)?
2006 Aug 04
1
ActiveRecord, Mysql, NULL columns and uniqueness
Hi all. Mysql allows to set multiple NULLs on columns with unique constraint, it''s normal SQL. Well, but when I try to submit some form, all unspecified values will be consodered as '''' (empty string) and (Mysql::Error: Duplicate entry occurs (((. How I can teach ActiveRecord to consider empty fields as NULL?
2007 May 25
7
Storing large BLOBs in the database with ActiveRecord
I have a model called Product with an attribute called file of type :binary (DB BLOB). If I do product.save (where product is an instance of my Product model), here is SQL statement that the mysql adapter for Ruby will do: INSERT INTO `PRODUCT` COLUMNS(NAME, PRICE, FILE) VALUES(''PROD1'', 4.56, X''00DEF033423023220'') All is hunky dory for as long as my BLOB is
2012 Jun 30
4
find_by_sql and join
hi I amd tanizawa. I had problem. I can not get main.name value from below sql. "find_by_sql ''select main.id,main.name,sub.name from main left join sub on sub.id = main.id''" Please teach me how to get borth name value. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the
2006 Jan 31
2
Relationship navigation issue
class Event < ActiveRecord::Base belongs_to :venue belongs_to :category end class Venue < ActiveRecord::Base belongs_to :city end class City < ActiveRecord::Base belongs_to :state end I want to retrieve all event records belonging to a state. Coming from hibernate background I tried something like this: def self.list_for_a_state(state_id) find_by_sql(["select e.*
2004 Sep 10
3
FLAC as part of the Ogg project?
Matt Zimmerman wrote: > > As I understand it, the current Ogg/FLAC implementation simply wraps the Ogg > bitstream format around a normal FLAC stream, thus not utilizing the > features of Ogg, and duplicating various bookkeeping data. If the Ogg folks > were to spec out a FLAC-based codec for Ogg, it would likely look different > from the current implementation. > Right.