Displaying 20 results from an estimated 300 matches similar to: "AJAX call chain and DRY questions"
2006 Mar 05
1
access methods defined in helper
Hey
How do I access methods that I have defined in helpers?
__________________________________________
Helper id_browser_helper.rb:
module IdBrowserHelper
def table_identities(message)
render_text message
end
end
___________________________________________
Controller id_browser_controller.rb:
class IdBrowserController < ApplicationController
def view_genre()
2006 Jun 25
2
how to write the codes in view?(newbie question)
Hi.
I have two tables and want to join them.
<genres>
id
genre_name
genre_order
<links>
id
genre_id
name
symbol
url
order
display
etc
The code of links_Controller is like below.
def list
@links = Genre.find(:all,:include => :link)
end
Below is the mysql log.
SELECT genres.`id` AS t0_r0, genres.`genre_n
ame` AS t0_r1, genres.`genre_order` AS t0_r2, links.`id` AS t1_r0,
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 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.
2007 Oct 11
1
OpenVox A400P01 not detected
Hello
Has someone used the OpenVox A400P01 (ie. a supposedly
Digium-compatible A400P board with a single FXO module
www.openvox.com.cn/products_detail.php?genre_id=9&id=28) successfully?
I've put it in an older PC with a Gigabyte GA-7ZX motherboard, then a
more recent PC with an Asrock K8NF4G-SATA2: dmesg returns nothing :-/
Is there something specific that needs to be done in either
2009 Jan 16
2
mini-PCI FXS card?
Is there any product that's a single port mini-PCI FXS card?
I'm aware of the Openvox A400M
<http://www.openvox.com.cn/products.php?genre_id=39>, but I really only
wanted one port.
How about a single or dual port PCI or PCI express FXS card?
Basically I wanted to build a small linux router with one or two phone
ports.
Alternatively, is there already a router or single board
2007 Oct 08
2
Voice server
Hello
Now that I received an OpenVox PCI card
(www.openvox.com.cn/products_detail.php?genre_id=9&id=28), I'm ready
to try and set up a voice server with Asterisk.
We need the following features:
1. When customers call in, they should hear a voice menu asking them
which software they're calling about
2. Next, they should be able to leave a voice message to explain what
their problem
2005 Apr 16
1
Accessor not set
Hello!
I have a list of bands, and each band belongs to one genre:
class Band < ActiveRecord::Base
belongs_to :genre
end
class Genre < ActiveRecord::Base
has_many :bands
end
In the list.rhtml, when I do:
<% for band in @bands %>
<td><%=h band.genre.name%></td>
</tr>
<% end %>
it gives me: _undefined method `name'' for nil:NilClass
2006 Jul 07
1
Add_column not working
I try to add a column using migration in the table tests with the name
namn as a string. Doesn''t work. Any idea why?
def self.up
add_column :tests, :namn, :string
end
--
Posted via http://www.ruby-forum.com/.
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 Aug 04
4
DRY DRY DRY
Hello everyone!
Ive been on rails for the last month or so and really enjoyed this
framework.
However its very hard to find documentation on how to do things right!
For example every beginner after a while realizes that having similar
CRUD actions in every controller and views for them is not DRY at all!
Few days ago I found http://dereksivers.com/rails-shared-controller.html
I quite like his
2007 Sep 22
0
How to DRY up controller action spec with different params.
I tend to write a fresh description block for every change in the parameters
for that specific action, because I hate conditionals in the example
describtion, e.g.:
describe SomeController, "handling GET /path/with/param/3" do
it "should do this"
it "should not do this if"
it "should still do that in both cases"
end
Seperate description blocks keep
2006 Aug 06
4
DRY Scaffolds
I''ve got 8 scaffolds, each one can be considered an ''item'', such as a
blog, photo, etc. Using login_engine and user_engine, I list all blogs
belonging to a user by saying:
@user=session[:user]
@blogs=@user.blogs.find(:all)
but then let''s say I want to create an option where I want to slice it
differently:
@user=session[:user]
if @someOption ==1
2006 Jul 02
1
DRY? Why select_date and select_date?
Why select_date and select_date?
I dont understand why having both (backward compat?).
I also look that their source are different, one use the InstanceTag
and others calls 3 select_(year, month, day) functions.
2006 Jul 17
1
How to DRY up validates_presence_of
Given the case of validating the presence of an attribute and then
performing other tests on said attribute, how do you go about not having
to check for nil in the other tests?
Example:
validates_presence_of :start_date, :end_date
validate :validate_start_date_before_end_date
def validate_start_date_before_end_date
# without this check an exception will be thrown on access to the
2006 Jul 28
1
How to set environment specific config variables DRY-ly
Sorry, search is down on the forum, so I don''t know if this has been
posted elsewhere.
I have some config variables that I want to have set in all
environments, and overridden in production.
What I want to do is put this in my config/environment.rb
SOME_CONFIG = 555
And then override it in config/environments/production.rb as:
SOME_CONFIG = 333
Problem is, using constants I
2006 Jun 10
0
DRY Up Lots o'' Mailers
I have a heap of
fill-out-form/send-website-operator-mail/send-user-confirmation types of
forms. It''s daunting when you think about how many files it takes to do
this. I''m not coming up with an obvious "Rails" way to pull it off, so I
thought it''d be good to know if anyone else has worked through this (7 per
form!).
models/
my_form_data.rb
2006 Jun 24
1
DRY up link_to_remote and its url_for
In an attempt to provide a gracefully degradable link_to_remote, I
repeat myself every time:
<%= link_to_remote(''Signup'',
{:url => {:controller => ''user'', :action => ''signup''}},
{:href => url_for(:controller => ''user'', :action => ''signup'')}) %>
Looked around the RDoc &
2006 Jun 26
2
DRY up selects in view
Here''s what I''ve got:
<% @fields.each do |field_name| %>
<tr>
<td>
<%= field_name.humanize %>
</td>
<td>
<% unless field_name =~ /_id$/ %>
<%= form.text_field field_name, :size => 40 %>
<% else %>
<%= select(:vendor,
field_name,
State.find(:all, :order