Displaying 20 results from an estimated 20000 matches similar to: "Create a pseudo-model from SQL query?"
2006 May 26
9
What syntax is this? belongs_to :Person
so when I''m reading the pick axe book second edition I don''t see
anything like the syntax you see people using in rails code.
Specifically when you see.
belongs_to :Person
has_many :Phones
etc
these are methods on ActiveRecord right?
Why is this invocation syntax never described in the Pick Axe book?
I do see things like attr_reader :some_attribute etc but you
2006 Jun 19
4
share model definition
I want to share everything about a model except the db connection. Is
this a reasonable way to do it?
module NotebookDefinition
--
Posted via http://www.ruby-forum.com/.
2008 May 10
4
Newbie: lambda do...end.should change(Model, :count).by(1). Doesn''t work
Hi to everyone,
I''m an RSpec, and BDD in general, newbie so in order to learn I have
chosen to use my personal website as a tesbed.
I''m having difficulties juggling with mocks, and in particula with the
following code.
Here''s the controller action:
def create
@album = Album.new(params[:album])
if @album.save
flash[:notice] = "album saved"
2001 Aug 20
4
Batch-Tagging oggs?
Hello all.
Quick question ('Cause I'm famished and have to get something to eat)
If I have a batch of files (wave and/or ogg) with a certain naming scheme.
Would it be possible for me to write a small nifty (newbie) dos-batch
program that could tag those ogg-files (or encode the waves with tags) with
regards to the namin parameters.
Let me clarify. I usually encode waves with the
2008 Sep 12
1
ArgumentError: Unknown key(s): dependant
Hello,
I came across an association error today with facebooker.
class Cover < ActiveRecord::Base
belongs_to :album
end
class Album < ActiveRecord::Base
has_one :cover, :dependent => :destroy
end
At the console:
>> Album.find :first
ArgumentError: Unknown key(s): dependant
from
2006 Aug 11
5
Why does no one like render_component?
Maybe I''m missing the point?
Lets take for example albums of pictures. If I have a scaffold for
each, and I''m showing an album, what if I want to list all of the
pictures that are in the album?
Surely, I''d want to call the List action in the picture controller.
render_component would do this perfectly. But we''re told not to use
render_component. So
2007 May 12
4
help, 1 error(s) on assignment of multiparameter attributes
Hi everyone!
I just started learning Ruby on Rails about a week ago for a school
project, and can''t seem to find a solution for something.
I have this inside the form inside of edit_albums.rhtml:
<%= start_form_tag :action=>''proccess_edit_album'', :id=>@album.id %>
....
Release Date: <%= datetime_select(:album, :release_date, :start_year
=> 1960)
2001 Dec 07
4
album portion of the tags request
I wanted to post publicly my problem with Jonathan's proposed album
requirements. Although I do apologize, since this thread is too big already.
The idea that as a requirement one should be able to identify the exact CD
a track was ripped from is not a valid requirement in my book (not for the
tags at least), and I hope I can explain why. Without knowing the exact
way Jonathan wishes to
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
2001 Mar 09
2
converting WAV to ogg
I am trying to convert some a few WAV files to ogg format (using
vorbis-tools-1.0beta4 oggenc).
I tried:
$ oggenc -o nash.ogg nash.wav
ERROR: Wav file is unsupported subformat (must be 16 bit PCM
or floating point PCM
ERROR: Input file "nash.wav" is not a supported format
And:
splay -d - nash.wav | oggenc -r -o nash.ogg -
The resulting file when played with ogg123 played so
2006 Jan 25
7
join fields for list views
I am sitting with the Agile book on my desk and scratching my head at
the discussion on aggregation - perhaps that isn''t what I need.
I have a db called clients.
fields include - first_name middle_initial last_name
I want to combine them all into one name element in a list view. I can
add/edit the fields separately but in the list view, I only want the one
combo field.
Is there a
2008 Jan 10
4
Mocking and stubbing Rails'' association extensions
I''m having a lot of trouble stubbing out an association extension for
some view tests. Example rails code modeling a music album:
class Album < ActiveRecord::Base
has_many :songs do
def streamable
find(:all, :conditions => ''streamable = 1'')
end
end
end
So for a given Album instance (say @album), I need to be able to stub
both
2011 Sep 18
9
Rails 3 and postgresql
I have a simple project created around a very, very simple database: one
main table packs with just three rows
Column | Type |
Modifiers
--------+-----------------------------+----------------------------------------------------
id | integer | not null default
nextval(''packs_id_seq''::regclass)
nombre | character
2016 Oct 07
3
RuntimeDyLdCOFF and RTTI on Windows
HI Stefan,
CC'ing Reid Kleckner, who might have some insight here, and llvm-dev as
this may be of interest to other windows JIT users.
I am facing the issue that C++ dynamic_cast doesn't work for types
> loaded from object files with RuntimeDyLd.
<snip>
Do you think it is possible that RuntimeDyLd misses type info data in
> the COFF file or doesn't wire it up
2006 Aug 09
1
How to Disable Callbacks on a Model
Does anyone know how to disable a model''s callbacks?
I have a routine that increments a page_view counter for various model
objects in an after_filter in my ApplicationController. I call this:
increment_page_view()
Rather that checking through the trace array in each model callback for
"increment_page_view" I''d rather disable the callbacks from inside
2006 Apr 25
6
Searching over multiple MySQL tables
I am racking my brain over this, probably because I only know very
simple mysql functions.
Basically I''ve got a few tables, ex:
Albums (id,name,band_id); Bands (id,name,label_id), and Label (id,name)
I want to search through both album.name, band.name, and label.name
throwing all results into a variable, with no redundant info.
I think what I need to be doing is setting up some
2001 Dec 07
5
PROPOSAL: Sub-Tagging
I mentioned sub-tagging in an earlier post. Here's a more in-depth mail on
what i thought of.
One of the debates going on here are whether ARTIST is worthy of life.
Another is whether the average user will bother filling in the detailed info
Jonathan wants. Of course, all tags are optional, but nevertheless we should
have a tagging-system that pleases _the_users_, that is, everybody:
1.
2007 Oct 18
4
Polymorphic Association?
Hi there-
I''m a newbie to this board, RoR, and web development in general. So
please forgive me if this is in the wrong place or if the solution is
really simple...
I''m trying to conceptualize the relationships between a series of
models for a page creation function. What I''d like is to have a
Content Page which consists of a series of Content Blocks. The
Content
2020 Apr 29
4
INITRD_MODULES
I am trying to take a CentOS 7 img and get hyperv to boot.
First step.
qemu-img convert "CentOS7.img" -O vhdx -o subformat=dynamic "CentOS7.vhdx"
after adding new hyper-v I get dracut-timeout...
So doing some searching it says add hv_vmbus hv_netvsc hv_storvsc to
INITRD_MODULES.
which doesnt really exist any more in CentOS 7.
I did find /etc/dracut.conf and add_drivers...
I
2006 Feb 15
8
Agile book - getting confusing error
Working through the beginning phase from the Agile book on
''Administration''
undefined method `hashed_password='' for #<User:0xb7911324>
...
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1498:in `method_missing''
#{RAILS_ROOT}/app/models/user.rb:12:in `before_create''