search for: country_id

Displaying 20 results from an estimated 40 matches for "country_id".

2010 Mar 26
7
seed data
Hi I am using seed_fu to seed initial data to tables (http://github.com/mbleigh/seed-fu) . And in db/fixtures/state.rb I have values like (I am filling only two data for simplicity) State.seed_many(:name, :abbr,:fips,:country_id, [ { :name => "Alberta", :abbr => ''AB'',:fips => ''01'', :country_id => 2 }, { :name => "Alaska", :abbr => ''AK'',:fips => ''02'', :country_id => 1 } ]) It works and when I do...
2009 Jan 28
3
Apply style in collection_select ?????
Hi to all, i have this snip i want to apply style to this combo but there is no effect help....... <%= collection_select(:customer,:country_id, @countries,:id, :country, html_options={ "style" => "width:110px" },:onchange => ''updateState('''');'',:id =>''country_id'' )%> Thanks, -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------...
2012 May 28
4
How to load a selection list into the method new of a controller?
...tring(2) not null # nome :string(30) not null class State < ActiveRecord::Base has_many :cities has_many :institutions, :through => :cities belongs_to :country end # == Schema Information # Table name: states # id :integer not null, primary key # country_id :integer not null # sigla :string(2) not null # nome :string(40) not null class City < ActiveRecord::Base has_many :institutions belongs_to :country belongs_to :state end # == Schema Information # Table name: cities # id :integer not null, primary...
2007 Nov 07
5
Unexplainable failure...at least for me
I have an address model with country_id and province_id fields There is also a full_address method that returns an address that is in a format that the google maps api will be able to return a long-lat coords. Within the full_address method there is a call to obtain the province/state and country name. --------- def full_address ......
2010 Nov 09
2
Undefined method
...to_table}(id) }.... end In my_app/db/migrate/001_create_airports.rb: require "migration_helpers" class CreateAirports < ActiveRecord::Migration extend MigrationHelpers def self.up create_table (:airports, :options => "ENGINE=InnoDB") do |t| t.integer :country_id, :null => false #foreign key t.string :code, :null => false, :limit => 3 t.string :name, :null => false, :limit => 45 t.timestamps end foreign_key(:airports, :country_id, :countries) end def self.down drop_table :airports end end When I rake db...
2012 Nov 17
2
Help needed for error in foreign key validation
...IMIT 1 when updating the bank table Can you tell me how to fix the issue? If I remove the validates_presence_of :country I get a database error as expected when i update bank table with a country id not in country table. class Bank < ActiveRecord::Base attr_accessible :name,:country_id has_one :country validates :name, :presence => true validates_presence_of :country end class Country < ActiveRecord::Base attr_accessible :name end -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk&...
2006 Jul 28
3
Forms: handle foreign keys (AssociationTypeMismatch)
...a form with proper validation and stuff for foreign keys... So I''d really like to get some help here. I''m creating a booking site for DJ''s, and for every booking one can choose one of different countries: class Booking < ActiveRecord::Base validates_presence_of :country_id validates_numericality_of :country_id # Necessary? Correct??? belongs_to :country, :dependent => true end class Country < ActiveRecord::Base has_many :countries end Now I have created a scaffold of the bookings, but sadly this does not include the wanted select box f...
2006 Apr 06
0
3 doubts on observe_field
...h the yours aid already I obtained to use observe_field, but still I am with some problems and necessary again. They are three questions to long of the source code below. Since already I am grateful for the tips. ==== _form.rhtml <!--[form:city]--> <p><label for="city_state_country_id">Pa?s</label><br/> <select id="city_state_country_id" name="city.state[country_id]"> *** QUESTION 1: How I can know if I am in the action new or edit without needing to create the @is_new variable? <% if @is_new %> <option selected va...
2006 Jul 02
1
multitable form
...g tables : type_of_user [id, typename] users [id, username, firsname, lastname, type_of_user_id, address_id] where type_of_user_id is a foreign key who references the type_of_user and where address_id is a foreign key who references the addresses table. addresses [id, street, number, box, zip, country_id] where country_id .... table countries [id, countryname] I wanna visitors to be able to register to my website so I make a pretty form : Username first name Last name street number box number zip code country All field are mandatory exept ''box number'' When someone register, t...
2006 May 17
3
RJS behave differently than render :partial?
...hat only makes a drop down of country areas for a specific country. When changing the country in the country drop down, it uses the :observe_field to call the below method and refresh the country_areas partial. def find_country_areas @country_areas = Country.find(:all, :condition => ("country_id =?", params[:country_id]) ) render :partial => "country_areas", :object => @country_areas end The country areas drop down is getting changed to reflect those country areas that are for a specific country, so all is well. Now if I change the above method to: def find_coun...
2012 Dec 29
2
I need intercept in plm model
Hi,R 2.15.2 plm() function on Windows 7 when i perform a plm regression, i can't manage to obtain the intercept, but I need it.it gives me just the beta coefficient. my formula: fixed <- plm(deltaS ~ L1.deltaS + L2.deltaS, data=Mody_R, index=c("country_id", "date"), model="within") my output: Coefficients : Estimate Std. Error t-value Pr(>|t|) L1.deltaS -0.063576 0.017950 -3.5419 0.0004031 ***L2.deltaS -0.068272 0.017966 -3.8001 0.0001474 ***--- I tried adding "-0", "+1", "interc...
2006 Jun 09
0
partials and rjs
I must have a misunderstanding of partials, maybe one of you can help me out. I have a page that initially displayed via the following: <-- in controller --> def find_areas_for_country @country_areas = CountryArea.find(:all, :conditions => ["country_id = :country", params], :order => "descr asc") render :partial => ''country_area'' end <-- my partial --> <%= select :country_area, :id, @country_areas.collect {|c| [c.descr, c.id]}, {:prompt => "-- Select Area --"}, {:name => &...
2007 Mar 20
2
collection_select - why doesn't it work?
...now why. <%= form.collection_select :origin_country, Country.find(:all), :id, :name %> gives me a select list with name="member[origin_country]". When submitting the form the following error is shown: Country expected, got String When I try <%= form.collection_select :origin_country_id, Country.find(:all), :id, :name %> I get the error undefined method `origin_country_id'' for #<Member:0x23f52e8> So I try it with <%= form.select :origin_country, Country.find(:all).map{|obj| [obj.name, obj.id]} %> but again the same "Country expected, got String&qu...
2006 Mar 18
10
collection_select''s linked
I created a form with two collection_select, country and state and would like to bring up to date the state list when to select a new country. How I can make this in Rails? Thanks Eleudson Brazil <p><label for="person_country_id">Country</label><br/> <%= collection_select(:person, :country_id, @countries, :id, :name) %></p> <p><label for="person_state_id">State</label><br/> <%= collection_select(:person, :country_id, @states, :id, :name) %></p>...
2013 Jan 04
1
plm random effect: the estimated variance of the individual effect is negative
...> I used this formula to get my result, and it works:reg <- deltaF ~ > L1.deltaF + L2.deltaF + deltaCDS + L1.deltaCDS + L2.deltaCDS + > L3.deltaCDS + deltaUS_Yields + deltaZ + L1.deltaZ + L2.deltaZfixed > <- plm(reg, data=Mody_R, na.action = na.exclude, > index=c("country_id", "datestata"), model="random") > but when i split my dataframe into several groups it gives me this > error:"Error in swar(object, data, effect) : the estimated > variance of the individual effect is negative" > The code i used to split the data...
2006 Feb 03
3
My associations are coming out nil.
...r="user_CountryId">Countryid</label><br/> 44: <select name="user_CountryId"> 45: <% @country.each do |country| %> 46: <option value="<%=country.id %>" 47: <%= '' selected'' if country.id == @user.country_id %>> 48: <%= country.countryname %> Does anyone have any idea of what I''m doing wrong, or why I''m not getting any obvious result from the association?
2006 Mar 01
1
observe_field question
I''m sure this is a simple problem, but I''ve been working on it for a couple days and can''t seem to figure out the correct way to structure my observe_field call. The HTML and Javascript generated all appear correct, but the AJAX call is never made. Below is the code I''m using and any help would be much appreciated. models_controller.rb def
2006 Apr 25
4
belongs_to :through
belongs_to :through Why is that not possible? We should have: Street belongs_to :city belongs_to :country, :through => :city -- Posted via http://www.ruby-forum.com/.
2006 Sep 06
1
Changing Scaffold
...line so I can study such thing? I saw "template_for_inclusion" in form.rhtml but couldn''t find out how to change it. Being more specific, I would like to change scaffold to create lookup combo boxes to simple tables. An example: I have table countries and states. States has a country_id field When I scaffold table states I would like it to generate a combo with countries. Thank you for your help. -- Ricardo Acras ricardo-WlbSPrj98RBeoWH0uzbU5w@public.gmane.org Acras Desenvolvimento de Sistemas +55+41-3232-6404 www.acras.net --~--~---------~--~----~------------~-------~--~----~...
2012 Nov 18
0
How mix jquery based ui packages and ruby on rails
I am trying to use jqx ui that is based on jquqery I have following questions 1. How do I generate the right id and name for the element without setting the element name and id in the format model name [attribute] ? Example <%= f.text_field :country_id %> generates sets the element id and name to bank[country_id] 2.how do i set the form element attributes like action ? Do i just use form_tag to generate the form? Thanks Anant -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group...