search for: city_ids

Displaying 20 results from an estimated 22 matches for "city_ids".

Did you mean: city_id
2011 Apr 08
3
Ruby on rails migration problem
Hello all, I have created a migration add_details _to users ... ( city_id , profession ) and then migrated it.. when i use params[:user] to update the database by taking user inputs from forms in views, it is not updating the database for these city_id and profession... ( not changing from null ) if add validation for presence of city_id .. it is giving the error "City id cant be
2006 Jul 25
6
form and pagination question
Hello, How do I get params from a form to use with a paginator? debug(params) shows this city: !map:HashWithIndifferentAccess id: "1" but in my controller, when I try to use @hotel_pages = Paginator.new self, Hotel.count(:conditions => "hotels.city_id = params[:city][:id]"), 3, @params[''page''] it doesn''t work. I suppose it''s a simple
2006 Aug 16
8
Multiple (AJAX) Observers on the Same Field and MSIE
I have been using multiple observers, i.e., observe_field(), on the same input field and relying on them to execute in the same order that they appear in the page. This has been working fine in FireFox, but it does not seem to work in MSIE; the requests come in and are processed in a different order. Now, I''ve always been a little hesitant about using this technique, but it always
2006 Aug 16
0
Multiple observer
Hi I have three drop downs (State, City, Locality) and would like to populate City based on State selection and Locality based on City selection. I have observers on two fields (State, and City). The observer_field on state works fine and it populates city based on state selection. But the observer on city doesn''t populate Locality. Now sure whats wrong with my code. here is the
2006 Aug 17
0
AJAX - Having Multiple SELECT (Drop Down), and dependency
Hi I have three drop downs (State, City, Locality) and would like to populate City based on State selection and Locality based on City selection. I have observers on two fields (State, and City). The observer_field on state works fine and it populates city based on state selection. But the observer on city doesn''t populate Locality. Now sure whats wrong with my code. here is the
2008 Jul 07
1
Non model cascading selects
In my model I have a city_id. ON the form I am using a cascading select to select the state, which then does a remote_submit to get the list of cities (and hence the city_id) for the selected state. The problem that I am having is that if I make a selection, hit SUBMIT and validation fails, the original selected state/city is now reset (ie, the values aren''t saved). Since they
2006 Mar 22
4
Newbie - populating select list from db
Can''t seem to find an example of this anywhere - how do I populate a select list in a form from a database? I have a form to create a new task. The task is for a client, so there should be a select list populated from my clients table. I thought this would work: <%= select ''task'', ''client_id'', Client.find_all, "id", "name"
2008 May 07
1
Assigning to the foreign key on a belongs_to association
I''ve encountered what seems like an odd omission in the behaviour of belongs_to associations: if you assign to the foreign key attribute, it doesn''t update the associated object (or mark a previously loaded one as stale) until you explicitly save or reload it. Let''s say we have a Company model, which belongs_to :city : >> torchbox =
2007 Aug 20
0
FormBuilder in rjs
I have a page, which renders a partial that contains a ''State'' drop down list. Upon change, it re-renders the ''City'' drop down, re- populating it based on selected state_id: Page: /customer/new.rhtml <% form_for :customer, :url => customers_path do |f| %> State: <%= f.collection_select :state_id, State.find(:all), ''id'',
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.*
2006 Apr 04
4
Find records based on associated table''s colums
Hello, Let''s say I have a model for a "house". Each house has_a "city", which in turn has_a "state" which in turn has_a "country". The objective is to retrieve all houses in a given state, say "Massachusetts". Being new to Ruby on Rails what I like is that things that should be simple usually are simple, and since we have easy access to
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 May 18
3
populating array of text_fields from an array of model objects
I have in my view the following: <% 0.upto(@num_performances) do |idx| -%> <%= text_field ''performance'', ''city'', :index => idx, %> <%= text_field ''performance'', ''venue'', :index => idx, %> <% end -%> and in my controller I have: @performance = [Performance.new("city" =>
2008 Dec 05
1
Question About Rails.cache and find method.
The DB load on my site is getting really high so it is time for me to cache common queries that are being called 1000s of times an hour where the results are not changing. So for instance on my city model I do the following: def self.fetch(id) Rails.cache.fetch("city_#{id}") { City.find(id) } end def after_save; Rails.cache.delete("city_#{self.id}"); end; def
2010 Feb 03
4
customizing validation msg
Hi, i am using the default validation of RoR how i will customize them i dont want to display the default message but i want to print the message i want like for city_id the default message is "City can''t be blank" i want this message as "Please enter city" Regards -- You received this message because you are subscribed to the Google Groups "Ruby on Rails:
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
2007 Oct 26
1
Custom method in Application Controller
Hi All, I took this idea Christian Hellsten and Jarkko Laine''s "Beginning Ruby on Rails E-Commerce". Here is the situation. I will be using the "options_from_collection_for_select" and "collection_select" form helper methods in my view to render drop-down selection lists for City and State that have corresponding city_id and state_id foreign key references
2013 Apr 02
4
gmaps4rails: undefined method `model_name' for NilClass:Class
Hi All, just in a spot of bother with this gem, I am trying to create a new location and get the above msg. here is my controller: class LocationsController < ApplicationController # GET /locations # GET /locations.json def index @locations = Location.all @json = Location.all.to_gmaps4rails end respond_to do |format| format.html # index.html.erb
2006 Apr 12
22
Dynamic Select Box
Hi, I''m new to rails/ruby having come from PHP and am just starting to get my head round how easy it can be :) However, can anyone point me in the right direction for dynamicaly updating a select box based upon the choice of a previous select box, without a page refresh. Any and all help greatly appreciated. Thanks -- Posted via http://www.ruby-forum.com/.
2007 Oct 05
1
Custom helpers for list of options?
Hi all, I have a model that "belongs_to" many other models, many of those models are just list of names, like country, state, city, profession ... I read about the country_select helper. Is better to have all those tables or use custom helpers? what the rails way? Thanks. For example : http://pastie.caboo.se/104092 # = Schema # country_id integer # city_id integer #