search for: language_id

Displaying 17 results from an estimated 17 matches for "language_id".

2011 Jul 25
5
Arel quiz: complex queries with associations
...ies like this: list all people''s names alphabetically > Person.order(:name).all.map(&:name) how many people speak french? > Person.joins(:language).where(:languages => {:code => ''fr''}).count How many German people are in the data set? > Person.where(:language_id => 2).order(:name).count Create a list of them alphabetized by name > Person.where(:language_id => 2).order(:name).all.map(&:name) How many people have the first name that begins with "A"? > Person.where("name like ''A%''").count I''m n...
2005 Dec 30
5
HABTM with finder_sql problem (Rails bug?)
...g an app that needs i18n support across the entire database (i.e. localized attributes). In order to do this I''ve created a special HABTM join table that can be associated with _any_ other table: create table language_strings ( for_table varchar(255) not null, foreign_id int not null, language_id varchar(5) not null, attr_name varchar(255) not null, value text not null, primary key (for_table, foreign_id, language_id) ); Notice the for_table and foreign_id columns. These two are used to identify the table and row to which each record belongs. To make this work I then add something li...
2006 Jul 24
2
InPlaceSelectEditor question
...an object in another table that is linked to the table that I''m editing. That also works except that it displays the ''id'' instead of the related value of the id in the other table. Sorry if that isn''t clear. Here''s the relevant code. Table item contains language_id (among other fields, of course) Table language contains id, lang (the latter having the language in English) <% for @item in job.items %> <tr> <td><%= in_place_editor_field :item, :title %></td> <td><%= in_place_selec...
2006 Aug 02
4
is it possible to duplicate a key? --new
Im not very familiar with RoR so this question might be kind of silly. I want to store strings from different lenguages in a database. I want to have the key for the string in english be the ''key'' for all the corresponding traslations of that string. For example: (database columns) lenguage-------------key-----------------value----- english hello
2006 Nov 04
0
Using collection_select and ajax
...want to use Ajax to render a filtered list of items based on the language selected. I don''t want the user to press a Submit button nor refresh the page, of course. I''m using the standard collection_select in my view: <%= collection_select (''item'', ''language_id'', @languages, ''id'', ''lang'', {}, { :id => ''lang_select'' } ) %> <%= observe_field( ''lang_select'', <snip> %> This renders as follows: <select id="lang_select" name="item[language_id]...
2006 Aug 27
3
n-to-m relationships in Forms
Hi, I can''t understand the RoR-API concerning certain form helpers. Can you maybe help me? I have a model, Film, with a habtm-relationship to the model Language. Now if I want to have a form for editing/creating a Film, I''d like to have checkboxes for each Language with those checked that are associated with the Film in question. Is there an "easy" way to do this
2006 Jul 07
0
has_many relation handling
...> 30 end create_table :categories do |t| t.column :category_id, :integer (3.) t.column :created_at, :timestamp t.column :updated_at, :timestamp end create_table :categorytranslations, :id => false do |t| t.column :category_id, :integer t.column :language_id, :integer t.column :name, :string, :limit => 60 t.column :description, :string, :limit => 120 end My models: class Category < ActiveRecord::Base has_one :category (3.) has_many :categorytranslations, :dependent => true (1.) has_many :languages, :through => :c...
2006 May 11
2
Making my site multi-lingual
Hi, I''m wondering how I should go about making my website multi-lingual. Basically, there will be different content for the different languages, and that''s not really a problem... all I need to do is give each content entry in the database a language_id. But the problem is with the non-content text, eg, "In order to access this area, you must be logged in", "Created by", "Last updated" etc. Surely rails has a way of making this simple. I just can''t find it. Anyone know how?
2006 Jun 05
0
Failed to install Globalize plugin
...======================================== -- create_table(:globalize_countries, {:force=>true}) -> 0.2110s -- add_index(:globalize_countries, :code) -> 0.3000s -- create_table(:globalize_translations, {:force=>true}) -> 0.1600s -- add_index(:globalize_translations, [:tr_key, :language_id]) -> 0.2310s -- add_index(:globalize_translations, [:table_name, :item_id, :language_id]) -> 0.2200s -- create_table(:globalize_languages, {:force=>true}) -> 0.1700s -- add_index(:globalize_languages, :iso_639_1) -> 0.2810s -- add_index(:globalize_languages, :iso_639_2)...
2007 Dec 21
1
in_place_editor not working for Internationalization
...n''t get in_place_editor to work to translate the strings. My controller: class Admin::TranslateController < ApplicationController in_place_edit_for :translation, :text def index @view_translations = ViewTranslation.find(:all, :conditions => [ ''built_in IS NULL AND language_id = ?'', Locale.language.id ], :order => ''text'') end def translation_text @translation = ViewTranslation.find(params[:id]) render :text => @translation.text || "" end def set_translation_text @translation = ViewTranslation.find(params[:i...
2006 Feb 26
3
Rails Naming Conventions
DB field names: If I have a table that references 2 or more separate users from my users table, is there a recommended naming convention for this situation? In my case, I have 3 users associated with a record in my projects table: requester_user_id created_by updated_by I could name one of them "user_id", and then projects.user would work I guess, but wouldn''t work
2006 Aug 17
1
More on n-way.
...39;ll use an example of movie catalog, I''m realing doing a kind of movie catalog, for laerning rails, and I did this: Models: Movie, Actor, Director, Writer, Country, Language The Movie model HABTM Actor, Director and Writer, and belongs_to Country and Language @Movie id name country_id language_id year Join tables: movies_actors movies_writers movies_directors Everything works! But I have a situation where I can have an *Actor*, that is ALSO a *Director* or a *Writer too. If I update some Actor information, I have to update it on the other tables (Directors,Writers), if it''s there...
2007 Jun 14
1
HABTM and acts_as_list
I don''t think this needs much explanation. Is what I''m trying to do even possible? class CreateLanguagesProducts < ActiveRecord::Migration create_table languages_products do |t| t.column :language_id, :integer t.column :product_id, :integer t.column :language_position, :integer end end class Language < ActiveRecord::Base acts_as_list :scope => :product has_and_belongs_to_many :products end class Product < ActiveRecord::Base has_and_belongs_to_many :languages, :order =...
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 #
2002 Mar 04
1
String Resources & Popup Problem
Ok, that's done. Now after this the should compile and run : in En.rc MAIN_MENU is defined now like this : MAIN_MENU MENU { POPUP "&File" { MENUITEM "&New...", 0x100 En.rc is included by #include "En.rc" in rsrc.rc. And gcc complies about it when compiling : [syl@snoop notepad]$ make gcc -c -I. -I. -I../../include -I../../include -g -O2 -Wall
2007 Jul 18
10
Rails - Mock going out of scope?
Hello list, I think I have a rails related RSpec problem with a mock going out of scope on a recursive call to a model. The code is at: http://pastie.textmate.org/79821 if you want to see it highlighted. I have pasted it below as well. Basically, I have an acts_as_nested_set model called "Node", which works fine. I have a function which finds the language name of the node instance.
2007 Sep 30
9
Problems with testing nested routes using mocking
Hello forum I have there to files #----- virtual_host_controller.rb class VirtualHostsController < ApplicationController before_filter :capture_domain # GET /domain/1/virtual_hosts/1 def show @virtual_host = @domain.virtual_hosts.find(params[:id]) respond_to do |format| format.html # show.rhtml end end private def capture_domain if