Displaying 20 results from an estimated 100 matches similar to: "Rails doesn't validate create_model or build_model (has_one association)"
2007 Jul 11
4
Query scoring - WTF?
Hi!
I thought I understood Ferret''s query scoring and how to tweak
results using boost values. What I currently experience however,
leaves me completely baffled.
Perhaps someone can shed some light on the scoring algorithm, because
asking Ferret to "explain" the score for a particular document isn''t
as informative as I thought. Actually, it confuses me even
2009 May 25
1
Help --- My phone number field saves blank
I have a phone field in my table.
But in my form i have two text boxes to get the phone number and the
country code like below
Enter country code ----- Enter phone code ------
In my table i have to save the phone code field after joining the above
values with "-" symbol.
Example => 0225-25874255
I dont have table field for country_code .
So i created like below
attr_accessor
2004 Mar 11
5
win32-etc-0.2.2 testing wanted
I''ve commited code for win32-etc 0.2.2, which adds the configure_user and
configure_group methods. Testing appreciated. On my home system, I can''t
get configure_user to work, but I haven''t any real idea why it fails. The
configure_group method seems to work fine, however.
Dan
_________________________________________________________________
Fast. Reliable. Get
2012 Nov 18
2
Question about making histogram and x must be numeric
Hello all,
I hope someone of you can help me out, I have searched other posts as well
but I can't find any solution to the problem I'm dealing with.
I want to make a histogram from the data Telephone Lines
MDGdataset <-read.csv("MDG_dataset_2010.csv", header=T)
MDGdatasetAdapted <- subset(MDGdataset, select = c(Country_Code,
Country_Name, Year,
2008 Mar 19
2
Stub / Mock - A little guidance?
Hi there,
I''m still trying to wrap my head around when to use a stub and a mock.
If I understand this right, I should be using a ''mock'' when imitating
an object, but not its behavior. I should be using a stub when I want
to imitate the behavior of an object. Does that sound about right?
With that said, I''m struggling a little trying to spec out this
instance
2010 Dec 07
1
fields_for and one out of many from association
class Person < ActiveRecord::Base
has_many :addresses
has_one :primary_address, :class_name => ''Address'', :order =>
''preferred desc, id''
accepts_nested_attributes_for :addresses, :allow_destroy => true
accepts_nested_attributes_for :primary_address, :allow_destroy =>
true
end
class Address < ActiveRecord::Base
belongs_to :person
end
2006 Aug 10
5
RJS in Internet Explorer to update a list box
Hi,
I''m trying some RJS to update a series of list boxes in which the user
selects a state, and the following list gets updated with a list of
counties, and the same for the next list of areas.
My code works perfectly (albeit a bit slow) on Firefox, but on Internet
Explorer it clears the list box (instead of filling it) and Netscape
shows all the counties cramped together on one
2006 May 17
2
Association data clobbering (foreign keys too?)
Can someone please confirm or correct the following statements?
If I have the following tables
create table as (id int, [...], b_id int);
create table bs (id int, [...], a_id int);
create table as_bs (a_id int, b_id int);
and the associations woould be defined like this
class A << ...
habtm :bs
belongs_to :b
end
so my Model A has a habtm collection of Bs *plus* a direct
2004 Mar 06
2
citrix stores addition information into SAM on pdc
hi,
we want to replace our nt4 pdc/bdc with samba and we use windows nt4 terminal servers with citrix in our environment.
as far as i know, we will get a problem here. (extensiver reading of the mailing list led me to this conclusion)
regarding: http://ma.ph-freiburg.de/tng/tng-users/2001-05/msg00224.html
>Terminal Server has its own User Manager (which has an extra button -
2011 Jul 14
1
RoutingError with RSpec Controller test on Scoped Route
So I have a route that looks like this:
scope "4" do
scope "public" do
scope ":apikey" do
resources :shops
end
end
end
And a bunch of controller specs, an example of which looks like this:
describe ShopsController do
describe "when responding to a GET" do
context "#new" do
it "should create a new instance
2006 Jan 25
12
DRY in Models
I am building an app right now that needs to grant access to three
levels of members right now - each will have their own table in the DB.
When creating the add_user action I am converting the password into a
hashed password through the model.
The way I am doing this right now, I will inevitably end up with
repeated code in three different models. Is there a way I can define
this code in
2011 Mar 01
11
Did rails or shoulda go insane on the inflection of 'taxes'?
I have a model ''xp_jurisdiction_taxes'' which rails (3) created correctly.
Another model ''xp_jurisdiction_states'' has many :xp_jurisdiction_taxes.
In my spec I am using a shoulda helper to test the association but get the
following error. BTW, greped the whole project just in case and the string
''taxi'' exists nowhere.
1)
2008 Mar 01
2
How to cache data in a plugin
Hi,
I''m using CountryCodes to get countries list for select box. It
provides self.countries_for_select(*args) method exactly for this
purpose. I''m using it in only one place in my view. So I was thinking
about caching this data somehow, so it won''t have to be recreated
every time the page is loaded.
The problem is that the plugin initializes its main @countries
2006 May 28
3
Validating Foreign Key
Howdy,
I''m a Rails beginner working on my first significant project with RoR.
I''m trying to figure out how to validate a foreign key (you know, make
sure the row actually exists.)
However, validates_associated doesn''t seem to be what I want to use, nor
does it work...
-- BEGIN --
class City < ActiveRecord::Base
has_many :schools
belongs_to :state
2008 Mar 17
1
Help needed with collection_select
I''m trying to get a collection select list to work, but I''m getting this
error: missing attribute: state_code
The code is a select list for states.
<%= collection_select(:states_code, :state, states.states_list,
:state_code, :state)%>
The above elements are as follows
1. table name (singular, full name is states_codes)
2. full name of state
3. select list that orders
2009 Feb 03
1
update_attributes! does not update nested model
Hi!
I have updated my app to rails 2.3. I have form that has few nested
models and I am happy that I can just write
accepts_nested_attributes_for :tasks, :allow_destroy => true, but
update_attributes! does not update my nested model. I have tried
update_attributes, and it works. Any ideas?
Few lines from log:
update_attributes:
SQL (0.1ms) BEGIN
Education Update (0.3ms) UPDATE
2009 Feb 09
3
RSpec Testing ActiveRecord config dependency.
I have the following library code:
def normal_time_now
return DateTime.now.utc if default_timezone == :utc
return DateTime.now
end
This is dependent upon a setting in config/environment.rb
# Make Active Record use UTC-base instead of local time
config.active_record.default_timezone = :utc
I want to test that I get the expected results with the config set to
utc and
2006 Feb 04
4
AJAX rendered select doesn''t get submitted
I have implemented the AJAX observe_field to filter the state/province options
in my address form. This works great except when I submit the form, @params
doesn''t contain the select element.
_address_form.rhtml relevant snippet:
<%= collection_select(:address, "country", Country.find(:all, :order =>
"position"), :code, :name, {:prompt => "-- Select
2012 Sep 16
1
“Routing Error No route matches {}” when omniauth failed on registration
(Original question was asked here:
http://stackoverflow.com/questions/11506734/routing-error-no-route-matches-when-omniauth-failed-on-registration
)
I am using omniauth-identity and configure its "fail on registration".
My files:
config/initializers/omniauth.rb
OmniAuth.config.logger = Rails.logger
Rails.application.config.middleware.use OmniAuth::Builder do
#...
provider
2011 Jul 14
0
MultiparameterAssignmentErrors
The attached file show the error I''m getting.
I have a time time in my migration and a time_select:
<%= f.fields_for :company_layout do |company_layout_form| %>
<p>
<%= company_layout_form.label ''Horário de abertura'' %>
<%= time_select(''company[company_layout_attributes]'', :opening_hours,
:ignore_date => true,