similar to: Using One Lookup Table for Multiple Model Properties

Displaying 20 results from an estimated 300 matches similar to: "Using One Lookup Table for Multiple Model Properties"

2007 May 05
4
autogenerated it (was ''Custom Matcher and NAME NOT GENERATED annoyance'')
> On 5/5/07, Luis Lavena <luislavena at gmail.com> wrote: > > describe "A User (in general)" do > > before(:each) do > > @user = User.new > > end > > > > it { @user.should have_many(:contest_public_votes) } > > it { @user.should have_many(:design_industry_user_interests) } > > it { @user.should
2006 Aug 11
5
Unit tests - NilClass problem
Hi! Yesterday I started to write my unit tests for the fist time using rails. I''m using this method: http://blog.codahale.com/2005/12/23/a-rails-howto-simplify-your-unit-tests/ My customer_test.rb looks like this: require File.dirname(__FILE__) + ''/../test_helper'' class CustomerTest < Test::Unit::TestCase fixtures :customers # Replace this with your real
2011 Sep 14
1
rspec and should have_many through
Hi, Anyone can help me with rspec shoulda validations please. I can''t get the syntax right for these validations. Please correct me it { should have_one :tradable, :through => :trade_order} it { should belong_to :source, :polymorphic => true } it { should have_many :transfers, :as => :source } this is for Rspec 2, rails 3.1, gem "rspec-rails" gem
2007 May 05
10
have_one and have_present
>Comment By: Luis Lavena (luislavena) > Date: 2007-05-04 23:37 > describe "An Asset" do > before(:each) do > @asset = Asset.new > end > > it { @asset.should have_one(:attachment) } > it { @asset.should have_present(:something) } > end Food for thought on these. I like have_one a lot. It speaks to me as a Rails developer and I think it speaks to
2009 Oct 12
2
yaml ?nodes? or nested maps
I want to iterate ?nodes? and ?leafs? for a yaml document: thufir@ARRAKIS:~/projects/rss$ thufir@ARRAKIS:~/projects/rss$ ruby user.rb user.rb:6: undefined method `[]'' for nil:NilClass (NoMethodError) from user.rb:5:in `each_key'' from user.rb:5 thufir@ARRAKIS:~/projects/rss$ thufir@ARRAKIS:~/projects/rss$ ruby user2.rb user2.rb:5: undefined method `[]'' for
2007 May 04
2
Custom Matcher and NAME NOT GENERATED annoyance
Hello RSpec users, Have been using RSpec since 0.8.2 (not too long ago, I must say). and been creating my custom matchers since was defined as "good practice". Also, auto-generated names for the examples is very helpful, I''m trying to take advantage of it. Since I often prior code/define all the "examples", I have created a few matchers to fulfill associations and
2007 Mar 29
21
a better "should have valid associations"
This is pretty much the same as last time around, if you recall. Thanks to Wilson for converting to the new form. I''ve added a few lines. Basically, it iterates over your model associations and does two things. - First, just try to call the association. Usually fixes speeling erors or other such silliness. - Second, try to find a record with an :include on the association. This
2008 Feb 11
1
STI question
Hi, I am learning Single Table Inheritance and have a question. In my application, a message may be written by a user or by a guest. Thus a writer of a message is virtually associated either to a user or a guest. class Message < ActiveRecord::Base end class UserMessage < Message belongs_to :writer, :class_name => ''User'' end class GuestMessage < Message
2009 Aug 24
5
extract keywords from string
hi - i have strings that i need to extract keywords from. the string might have html tags, urls, etc. i need to extract the keywords from the string. i imagine i''m not the first guy to have to tackle this problem. is there a gem i can use or anyone have any ideas how to approach this? thanks, dino
2012 May 03
3
inheritance with rails.
Hello. I''ve read about examples on inheritance with rails. Here is an example: http://juixe.com/techknow/index.php/2006/06/03/rails-single-table-inheritance/ The way is to add a type field in the table. So if I have an Animal class with an attribute name, I can inherit from this class like: Dog < Animal, Cat < Animal, and so on. With the type field in the table I can do Dog.all,
2012 Jun 12
5
Wxruby Homepage Hijacked
Hi, It seems like the wxruby homepage has been replaced by a mortgage broker. I do need to refinance, but I was more interested in some documentation on wxruby. Is this a sign that the project is fading into oblivion? If so, I would really like to know what new cross-platform library people are using for developing ruby desktop applications. Josh
2014 Aug 08
6
CentOS 7 - Firewall always allows outgoing packets?
Hello all: I am looking at the documentation of the new firewalld service in CentOS 7. It looks like no matter what I configure with it, outgoing connections are still going to be allowed. That does not seem very secure. I always set my servers to default policy of DROP for everything incoming and outgoing and then add rules to allow very specific traffic through. Is this possible using the
2007 Feb 17
3
Problem with busydetect and cell phones
I have a very strange problem I'm hoping someone has encountered already. I've scoured the internet for an answer to this one. My phone company provides no disconnect supervision. Hence I'm forced to use the busydetect feature. I have a TDM400 with two FXO ports. If I call from an internal extension to a landline and then hangup the landline Asterisk detects the busy signal
2007 Mar 13
2
turn regression coefficients into matrix or...
I don't have much experience with r. What I am trying to do is to turn regression coefficients (after I run a lm or glm model) into some matrix such that I can do some post-estimation calculation, for example predicted probabilities in glm model, etc.. Or, is there any function in r that I can use to do something along that line? thanks. Jun Xu, Ph.D. Department of Sociology Ball State
2014 Aug 10
3
Centos 7 - iptables service failed to start
Hello all: I did a fresh install of CentOS 7 on a new machine. I wrote /usr/local/bin/firewall.stop to remove all the firewall rules. It contains this code: # Flush the rules /usr/sbin/iptables -F # Set the default policies to accept /usr/sbin/iptables -P INPUT ACCEPT /usr/sbin/iptables -P OUTPUT ACCEPT /usr/sbin/iptables -P FORWARD ACCEPT I wrote /usr/local/bin/firewall.start to set the
2006 Jan 11
6
How to display the error messages from the controller
I have a wizard which consists of two pages. To keep it simple let''s say that the first page asks the user to select a state from the drop down menu. In case the user doesn''t select any state, an error message needs to be displayed. Ideally I would like to do something like this. def new selected_value = params[:addevent][:state_id] if selected_value == "-1"
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.*
2012 May 28
4
How to load a selection list into the method new of a controller?
Hi friends! I''m relatively new with Rails and I''m struggling for a long time with this problem (it should have a pattern solution but until now I didn''t find it): I have the following models: Institution, City, State and Country. class Country < ActiveRecord::Base has_many :states has_many :cities, :through => :states end # == Schema Information # Table
2006 Jul 14
20
Method for associated relationships
I have these tables set up like this: listings has_many :states <field>state_id [int] <other fields.... .............. .............> states belongs_to: listings <field>name <other fields.. ............... .................> In my view I have <%= listing.name %> have also tried listing.state_id.name , that didn''t seem to do the magic either. This
2007 Jun 04
1
acts_as_rateable in Beast
I''m trying to implement acts_as_rateable to my Beast installation to give users the option to rate posts (like reddit). I chose acts_as_rateable as it supposedly easily allows reddit-type voting but I''m having some problems setting it up and the documentation seems outdated. (http://www.juixe.com/techknow/index.php/2006/07/05/acts-as-rateable-plugin/) So far, I''ve