similar to: how to write the codes in view?(newbie question)

Displaying 20 results from an estimated 200 matches similar to: "how to write the codes in view?(newbie question)"

2006 Apr 22
9
one to many question
1. A category has parent categories. 2. A product is in many categories and a category has many products. 3. Products and category both have images in the same image table. ie. a product and / or category could have multiple images.<=== my question is related to this So among other things I presume I have to do the following: class Category < ActiveRecord:Base #...
2006 Jan 09
3
Include with two references of one model of the same table
Hey guys, I just came across this oddity, not sure what to make of it yet, but I think it might be incorrect behavior. When doing a @inst.find(:all, :include => ["hometeam", "awayteam"] ...) hometeam and awayteam are two references from a belongs_to that is of the same model and of the same table. I will get a pgerror stating that "matches", which is
2006 May 23
5
AR Caching and Reflection
When I do this: term = Term.find(1, :include => :definition) term.definition.term Two SQL queries are fired, why? -- Posted via http://www.ruby-forum.com/.
2006 Apr 10
1
random | in join statement with more than one :include
I have an ActiveRecord class that has several has_many,belongs_to, habtm, and the new has_many => :through relationships. Whenever I try a find(:all, :conditions => "some conds", :include [:relationship]) it works fine, but if I have find(:all, :conditions => "some conds", :include [:relationship, :other_relation]) it gets a sql error such as Mysql::Error: You
2006 Jul 16
6
How to access element attributes using RJS?
For example, in the following block: page.select(''.foo'').each do |element| ... end How would I access, just for example, the id attribute of each element in the collection? I''ve randomly tried element.id and element.attributes[''id''], but neither of those has worked. I''ve also been unsuccessful in finding any documentation on this, but it
2006 Apr 23
1
checkboxes for filtered search
I have a page that renders a series of about 20 checkboxes on the left hand side with content on the right. These checkboxes are created from a DB and that part is all working well. What I want to do is have a user click on a checkbox [genres] and have the content on the right be filtered based on the checkbox ticked. If a user clicks on more than one checkbox than only those stories
2013 Oct 08
4
'puppet storeconfigs export' killed
Hi, I currently have a MySQL database containing all Puppet storeconfigs. My intention is to migrate to PuppetDB on a PostgreSQL server, so the first step is to use the ''storeconfigs'' face to export all the DB to a file PuppetDB can later consume. But the ''puppet storeconfigs export'' command always ends up being killed, I suspect due to some sort of OOM
2004 Aug 06
0
a new directory service
Hello. About your idea, I think that it is important for a radio to "check" multiple styles. I'm planning to cast a couple or 3 of stations that are _not_ monographic and will be "sports" from x to y hours, "pop" from y to z hours, "talk" from z to p hours and so on. That is because people that are listening the same genre for hours want to change. Why
2006 Jul 04
13
NewBie question
Hi, I m very new to Ruby. I bought a book "Ruby on Rails" and I think I understand some concepts. My question is : Is there a way to not use "Cookies" or "Sessions Variables" to keep some information about the user. I ask this question because I would like to prevent some cases where the user browser won''t accept cookies. I m from Asp 3.0, and I
2006 Jul 17
1
acts_as_tree and :include
hello there, i have a model that uses acts_as_tree: >class GbEntry < ActiveRecord::Base > acts_as_tree :order => ''created_at DESC'' >end and i want it to paginate, including all children to avoid unnecessary db queries: > @gb_entry_pages, @gb_entries = > paginate :gb_entries, :per_page => 15, :order => ''created_at DESC'',
2007 Sep 23
3
Connecting a row of an unknown table to another row of an unknown table
Hello all, I''m currently designing a web app in Rails that lets me keep a directory of free/opensource computer games. Each game has attributes like name, website, review, etc., but each game can also be associated with a set of genres and gameplay elements. The main three tables I''m working with are "games", "genres", "elements",
2007 Jun 18
4
polymorphic validation
Hello I have 2 models. link.rb has_many :categories, :as => :categorized validates_presence_of :name, :url, :created_at, :category category.rb belongs_to :categorized, :polymorphic => true validates_presence_of :name Everything seems to work. I select my category from a select tag. The problem is i don''t know how to validate if category is for example empty (nothing in a
2005 Dec 15
2
HABTM being tricky
I''ve just been bodyslammed by a problem with has_and_belongs_to_many - as far as I can tell, if it doesn''t appear at the top of other relationship definitions it doesn''t seem to work right. For example: class Artist < ActiveRecord::Base has_and_belongs_to_many :genres has_many :albums has_many :videos has_many :cds has_many :collections end ..works fine
2004 Aug 06
16
a new directory service
So I've been doing some research and thinking here and there about what a _good_ directory service for icecast would be like. I'd appreciate some feedback and some discussion on this topic, before I start putting a lot of effort into developing it. First off, I think getting rid of # of listeners is a must. It just creates a self-fulfilling prophecy and encourages cheating. I think the
2006 Mar 04
3
select helper method
Hey I''m having problems understanding the select helper. Here is my code: _____________________ DB table: genres id name descripition ___________________ In the controller: def index() @genres = Genre.find_all.map {|u|[u.name, u.id]} @id = params[''genre''] end ____________________ In the view: <% @genre = Genre.new @genre.id = @id %>
2013 Sep 18
4
Opus now supported at Magnatune
This seemed to be the best place to let you guys know.... Magnatune.com's entire catalog is now downloadable in Opus format, with full metadata (small and large cover art) at 128k stereo. A few comments: 1) I'm really impressed by your metadata implementation. It's very cleanly done, and the multiple artwork idea is fantastic. One suggestion: I couldn't find an example in the
2004 Aug 06
2
Directory listing disappeared
On 22 Mar 2003, Karl Heyes wrote: > ethereal is a good tool for that, start a capture (maybe with a capture > filter of "port <port>" or "host <ip>" to limit it if the box has plenty > of traffic), connect the source, wait a second then stop the capture. > Pick one of the packets that relates to the source stream and do > tools->follow tcp stream.
2004 Sep 10
1
xmms plugin, fileinfo
--- Miroslav Lichvar <lichvarm@phoenix.inf.upol.cz> wrote: > On Fri, Nov 15, 2002 at 09:07:39PM +0100, Miroslav Lichvar wrote: > > Here is preliminary patch for fileinfo for xmms plugin. Saving and > > removing of the tag isn't working. > > Ok, no comments, so here it is. sorry, couldn't keep up this weekend... > > When saving, how handle id3v1, v2? >
2013 Apr 03
1
validates uniqueness scope allow_blank/allow_nil -> validation error
I have this in a model: class GenreBadge < ActiveRecord::Base belongs_to :game, counter_cache: :genre_badges_count, touch: true belongs_to :genre validates :game_id, uniqueness: {scope: :genre_id}, allow_blank: true end When I get one existing genre badge genre_badge = game.genre_badges.first genre_badge.game_id = nil genre_badge.save! It creates an validation exception:
2007 May 29
2
OpenVox A400P01on thin client?
Hello, I'm thinking of ordering an OpenVox A400P01 (A400P + 1 PORT FXO Bundle) for use in a old IBM 8364 thin client: http://www.openvox.com.cn/products_detail.php?genre_id=9&id=28 http://silicon-verl.de/home/flo/software/netstation-8364/ Has someone already used this hardware with Asterisk, especially on a small piece of hardware like this, and could offer some feedback? Thank you.