similar to: Problems with associations

Displaying 20 results from an estimated 1000 matches similar to: "Problems with associations"

2012 Feb 07
10
Encoding error
Hello, I have in my db a register what have special characters, and when I try to put on my form to edit this values, this happens: incompatible character encodings: UTF-8 and ASCII-8BIT Extracted source (around line #4): 1: <%= form_for :group, :url => { :action => "update" } do |f| %> 2: <%= utf8_enforcer_tag %> 3: <label>Nome do grupo</label>
2006 Jul 18
13
RANDOM
I am pretty much new at this ROR game and had what I think to be a simple question. I have a set of Sponsors that I would like to be able to select one at random and display in the my html. I have already set up the DB, scaffolded, set index controller and all is working smoothly. I know that I can display them all by doing <% for sponsor in @sponsors %> <%= sponsor.name %>
2012 Mar 05
8
Create a select with HABM
Hello, I have two tables with association HABM, projects and users, and in projects I want to show all users that was associated to the project. I have try with this: <%= select( "user", "id", Project.all.collect { |p| [ p.name, p.id ] } ) %> But only show all my projects, but Iz don''t know who show only the user in a determinated project. class Project <
2010 Jul 20
4
MySQL index question
I am trying to speed up some DB operations and perhaps have gone overboard with indexes. Does MySQL usually use only one index per query and simply match keys on the results of the indexed first part? For example: DELETE FROM tokens WHERE 6813946236211560448 <= fnv AND fnv < 6818449835838930944 AND updated_at<''2010-06-20 14:08:55'' AND occurrences=0; If I understand
2012 Jan 21
16
Installing rails on Ubuntu
Hello, I''m trying to install the rails on ubuntu 11.10, but when I put the command felipe@Felipe:~/Downloads/rubygems-1.8.15$ sudo gem install rails --no-r1 --no-rdoc ERROR: Loading command: install (LoadError) no such file to load -- zlib ERROR: While executing gem ... (NameError) uninitialized constant Gem::Commands::InstallCommand felipe@Felipe:~/Downloads/rubygems-1.8.15$
2012 May 31
14
How install libv8 (therubyracer) Windows 7
Hello, I have a problem when I try to add the gem therubyracer. I put in my prompt: bundle install, and this error appears: C:\rails\organily>bundle install Fetching gem metadata from https://rubygems.org/......... Using rake (0.9.2.2) Using i18n (0.6.0) Using multi_json (1.3.6) Using activesupport (3.2.3) Using builder (3.0.0) Using activemodel (3.2.3) Using erubis (2.7.0) Using journey
2012 Feb 17
5
undefined method `key?' for nil:NilClass PaperClip
Hello, I have a problem with the paperclip, I put on my GemFile gem "paperclip", "~> 2.6.0" I create a migrate class FileUpload < ActiveRecord::Migration def up change_table :projects do |t| t.has_attached_file :image end end def down drop_attached_file :projects, :image end end on my model I put class Project < ActiveRecord::Base
2012 Feb 14
4
What I'm doing wrong, has_and_belong_to_many
Hello, I''m trying to insert into my migrate but when I try on rails console this error shows: 1.9.3-p0 :001 > group = Group.new => #<Group id: nil, name: nil, description: nil, created_at: nil, updated_at: nil> 1.9.3-p0 :002 > group.name = "Group Name" => "Group Name" 1.9.3-p0 :003 > group.description = "Description" =>
2012 Mar 01
1
MD5 in action
Hello guys, I need to make a hash in each register, but I don''t know how I can do this. Just like this: <%= link_to :action => "index", :hash => MD5 :project.id %> /index?hash=202cb962ac59075b964b07152d234b70 Thank all! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2006 Feb 17
1
AJAX and radio buttons
Hi! How can i use ajax with radio buttons? I have form with 2 radio buttons, which updates div with the value of selected radio button. It worked correctly when i used submit button, but when i removed it and used observers it didn''t. When i press the first button it displays its value, but when i press the second button it displays new value for a moment (0.5s ?) and then suddenly
2007 May 04
5
Something wierd with .save method
Hi, I have a very sime app. I need to create as many records in the db as the selected checkboxes (named :isselected) in the view. Here is the code snippet from the controller: isselectedhash = params[:isselected] for mod in isselectedhash.keys @issue = Issue.new(params[:issue]) @issue.state = ''NEW'' @issue.mod_id = isselectedhash[mod] # this gets
2011 Dec 02
20
Need Some Guides on Solr with Rails.
Hi Everyone, I am pretty new to Rails. I have very little idea about everything. But for my new project i have been asked to do some research on Solr search and implement it on Rails. Please provide me some link on tutorials and guides about Solr on Rails. Trouble is... have to do it by tomorrow. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are
2011 Oct 16
2
question: ragged array
Hello, I have a big problem which I’m just not able to solve. I created the following mean value from the following dataset structure: Id |value 1 | 2 1 | 3 1 | 4 2 | 2 2 | 1 3 | 5 4 | 3 etc.|etc. with the command: mean_rating <- tapply(ratok$value, ratok$project_id , mean,simplify = FALSE) this gives me a ragged array: > mean_rating [1] $`14`
2008 Jun 13
2
Rails 2.1.0 - find with :include and missing JOIN in SQL query
Hi, We''re trying to rewrite veeeery old Rails app that we successfully managed to move to 1.2.6 and now we''re trying with 2.1.0. One of the problems is caused by :include in AR.find. Rails 1.2.6 generates totally different SQL query than 2.1.0. Here''s Rails find query and generated SQL queries: Foo.find(:all, :include => :ticket, :conditions =>
2007 Jul 22
2
Seek brilliant Rails programmer to add one field to acts_as_taggable
I''m on the downhill side of a large project that requires an additional integer field to be added to the tag.rb in acts_as_taggable. I feel I have a good understanding of ActiveRecord and have performed the correct migrations. (As a short background for those following this thread) when one wants to add tags to a model they call the ''tag_with'' method that jumps into
2006 Jun 01
4
can''t convert Fixnum into String ??
I have been getting this error message on various pages, just wondering if anyone could explain whats going wrong, and the best way to correct it code that is cuasing the problem is below @project = Project.find(:first, :conditions => "id = " + @purchaseorder.project_id) -- Posted via http://www.ruby-forum.com/.
2007 Nov 02
5
RSpec, RESTful nested routes and :path_prefix
Dear list, In the app we are making we have a rout something like this: map.resources :projects do |projects| projects.resources :pages, :controller =>"Wiki::Pages", :path_prefix => "/projects/:project_id/ wiki", :name_prefix => "project_wiki_" end But I can''t get RSpec(I''m very new to it) to accept this. It keeps throwing errors:
2007 Nov 14
6
a few add_index questions..
on previous apps i hadn''t really worried much about adding foreign key indexes on my tables just because they''ve been fairly small and i didn''t really think i needed them. well, i''m working on something now that has the potential to have a lot more data, and a lot more foreign keys. so i have 3 tables... users, projects, and tasks.. should i be using add_index
2008 Sep 06
6
Active record question
I''m not quite sure how to get at this data using Actrive record.. I''m trying to get all the appointments made for a particular project. I''m using four models, Projects, Tasks, Resources and Appointments. The SQL gets me what I''m looking for but how do I do it using Active Record? Select a.* from appointments a join resources r on r.id = a.resource_id join
2005 Nov 16
1
HABTM: deleting records based on attributes
Hello All, I am new to ROR, and can''t seem to get HABTM to cooperate entirely... however I might be abusing it! Before I try a different strategy I thought I''d ask here and see if I''m missing something simple. So say Projects and Companies are related. Projects can have multiple Companies, and Companies can be on multiple Projects. But, the same Company can also