Re: [Rails] Re: has_many and belongs_to association

2011-07-15 Thread joanne ta
On Thu, Jul 14, 2011 at 4:49 PM, Michael Pavling wrote: > On 14 July 2011 21:24, joanne ta wrote: > >> Hang on... this is breaking when you're running tests? Have you raked the >>> DB changes into your test DB (I'm assuming that the dbconsole is showing you >&g

Re: [Rails] Re: has_many and belongs_to association

2011-07-14 Thread joanne ta
On Thu, Jul 14, 2011 at 4:21 PM, Michael Pavling wrote: > On 14 July 2011 21:14, joanne ta wrote: > >> me too.. i am so curious what is happened when name_id is in DB >> but it keeps saying no column :( >> >> > Hang on... this is breaking when you're

Re: [Rails] Re: has_many and belongs_to association

2011-07-14 Thread joanne ta
On Thu, Jul 14, 2011 at 4:10 PM, Michael Pavling wrote: > On 14 July 2011 20:46, joanne ta wrote: >> >> I am using commad " rails dbconsole " to get to the db >> and plus. I use the sqlite3 manager from firefox cho check too >> > > Well something

Re: [Rails] Re: has_many and belongs_to association

2011-07-14 Thread joanne ta
On Thu, Jul 14, 2011 at 3:41 PM, Michael Pavling wrote: > On 14 July 2011 20:37, joanne ta wrote: > >> I am using the rails dbconsole to check the field in DB >> >>> > Out of curiosity, *which* rails dbconsole are you using? What command do > you execute to ge

Re: [Rails] Re: has_many and belongs_to association

2011-07-14 Thread joanne ta
On Thu, Jul 14, 2011 at 3:32 PM, Michael Pavling wrote: > On 14 July 2011 20:12, joanne ta wrote: > >> >> Since you took the advice to change the foreign key from "name" to >> "name_id", you need to change the DB field to match. Alter your mig

Re: [Rails] Re: has_many and belongs_to association

2011-07-14 Thread joanne ta
On Thu, Jul 14, 2011 at 3:04 PM, Michael Pavling wrote: > On 14 July 2011 19:55, joanne ta wrote: > >> On Thu, Jul 14, 2011 at 2:40 PM, Michael Pavling wrote: >> >>> Have you read the error? >>> >>> Error: >>>> SQLException: table

Re: [Rails] Re: has_many and belongs_to association

2011-07-14 Thread joanne ta
On Thu, Jul 14, 2011 at 2:40 PM, Michael Pavling wrote: > On 14 July 2011 17:26, joanne ta wrote: > >> i changed it >> now it gives me an error >> > > Have you read the error? > > Error: >> SQLException: table languages has no column named name_id >&

Re: [Rails] Re: has_many and belongs_to association

2011-07-14 Thread joanne ta
i changed it now it gives me an error Error: test_validates_length_of_name(UserTest): ActiveRecord::StatementInvalid: SQLite3::SQLException: table languages has no column named name_id: INSERT INTO "languages" ("name_english", "name_id", "created_at", "updated_at", "id") VALUES ('english', 1, '2011

Re: [Rails] Re: has_many and belongs_to association

2011-07-14 Thread joanne ta
On Thu, Jul 14, 2011 at 12:10 PM, Michael Pavling wrote: > On 14 July 2011 16:47, joanne ta wrote: > > in language model > > belongs_to :name_id, :class_name => "Phrase", :foreign_key => "name_id" > > Why would you change the association na

Re: [Rails] Re: has_many and belongs_to association

2011-07-14 Thread joanne ta
On Thu, Jul 14, 2011 at 11:13 AM, Michael Pavling wrote: > On 14 July 2011 16:03, joanne ta wrote: > > On Thu, Jul 14, 2011 at 10:41 AM, Michael Pavling > wrote: > >> In Language, you have "belongs_to :name" (which is really Phrase), and > >> belongs_t

Re: [Rails] Re: has_many and belongs_to association

2011-07-14 Thread joanne ta
On Thu, Jul 14, 2011 at 10:41 AM, Michael Pavling wrote: > On 14 July 2011 15:33, joanne ta wrote: > >> On 14 July 2011 15:12, joanne ta wrote: > >> >> > class Language < ActiveRecord::Base > >> >> > belongs_to :name, :class_name => &

Re: [Rails] Re: has_many and belongs_to association

2011-07-14 Thread joanne ta
On Thu, Jul 14, 2011 at 10:18 AM, Michael Pavling wrote: > On 14 July 2011 15:12, joanne ta wrote: > >> > class Language < ActiveRecord::Base > >> > belongs_to :name, :class_name => "Phrase", :foreign_key => "name" > &g

Re: [Rails] Re: has_many and belongs_to association

2011-07-14 Thread joanne ta
On Thu, Jul 14, 2011 at 10:01 AM, Michael Pavling wrote: > On 14 July 2011 14:56, joanne ta wrote: > > It does work at all. it just keeps giving me the same warning .. > > ~language model > > class Language < ActiveRecord::Base > > belongs_to :name, :class_

Re: [Rails] Re: has_many and belongs_to association

2011-07-14 Thread joanne ta
On Wed, Jul 13, 2011 at 4:25 PM, Colin Law wrote: > On 13 July 2011 14:29, joanne ta wrote: > > > > > > On Tue, Jul 12, 2011 at 3:01 PM, Tom wrote: > >> > >> model language.rb > >> class Language < ActiveRecord::Base > >> belong

Re: [Rails] Re: has_many and belongs_to association

2011-07-13 Thread joanne ta
On Tue, Jul 12, 2011 at 3:01 PM, Tom wrote: > model language.rb > class Language < ActiveRecord::Base > belongs_to :phraes, :class_name => "Phrase", :foreign_key => "name" > end > I did fix the spelling already belongs_to :phrase, :class_name => "Phrase", :foreign_key => "name" > > Id phrase

Re: [Rails] error of testing has_many :through

2011-07-11 Thread joanne ta
On Fri, Jul 8, 2011 at 4:28 PM, Colin Law wrote: > On 8 July 2011 21:19, Yennie wrote: > > Hi everyone, > > > > I am testing the validation of association of the model but i can a > > error.. plzz help > > > > > > error > > /usr/local/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3/lib/shoulda/ > > acti

Re: [Rails] error of should validate_presence_of (shoulda)

2011-07-07 Thread joanne ta
do you have other way to validate presence with message On Thu, Jul 7, 2011 at 12:39 PM, thiagocifani wrote: > Hey dude, > > I think the most simplist thing to do here could be use the rails helper! > > validates_associated :pages, :library > > > shoulda should have some helper to verify the exi

Re: [Rails] error of "rake test" command

2011-07-04 Thread joanne ta
t; sudo gem install rake -v=0.8.7 > > > Chirag > http://sumeruonrails.com > > > > On Tue, Jul 5, 2011 at 10:18 AM, joanne ta wrote: > >> >> >> On Tue, Jul 5, 2011 at 12:45 AM, Chirag Singhal > > wrote: >> >>> Try using 'bundle ex

Re: [Rails] error of "rake test" command

2011-07-04 Thread joanne ta
bygems_integration.rb:197:in `block in replace_bin_path': can't find executable rake (Gem::Exception) from /usr/local/bin/rake:19:in `'" > > > Chirag > http://sumeruonrails.com > > > > On Tue, Jul 5, 2011 at 10:12 AM, joanne ta wrote: > >> >&g

Re: [Rails] error of "rake test" command

2011-07-04 Thread joanne ta
On Tue, Jul 5, 2011 at 12:38 AM, joanne ta wrote: > I did not have any test on my project. i just use bundle update rake > and then, it gives me that error.. > and I have 2 version of rake (0.9.2 / 0.8.7) do you know anyway that i can switch back to 0.8.7 > > > plz help >

Re: [Rails] error of "rake test" command

2011-07-04 Thread joanne ta
I did not have any test on my project. i just use bundle update rake and then, it gives me that error.. plz help thanks On Tue, Jul 5, 2011 at 12:24 AM, Chirag Singhal wrote: > Please include your test that is failing here. > Most probably the issue is that you are expecting a object somewhere

Re: [Rails] Error of undefined method

2011-06-21 Thread joanne ta
thanks you so much.. Joanne On Tue, Jun 21, 2011 at 1:29 PM, Chirag Singhal wrote: > Getting pretty late here, heading to bed. We can work on a cleaner solution > tomorrow or others on the forum can help. > For now, this quick and dirty solution should work: > > # In your view > <% @users.each do

Re: [Rails] Error of undefined method

2011-06-21 Thread joanne ta
On Tue, Jun 21, 2011 at 12:52 PM, Chirag Singhal wrote: > Ok, some more questions: > 1. So, you want to display an image of the culture associated with the > user, right? > yes > 2. How are you uploading pictures to your database? > right now, i just using the sqlite manager to upload the blob.

Re: [Rails] Error of undefined method

2011-06-21 Thread joanne ta
Ok, that's clear now. > > Do you use pastie (http://pastie.org/) or gist (https://gist.github.com/)? > If yes, can you paste following on any of them and reply with link? > No, I am not using that.. > > #models > User > id name address culture_id Picture > id image(binary) phrase_id culture_id

Re: [Rails] Error of undefined method

2011-06-21 Thread joanne ta
On Tue, Jun 21, 2011 at 12:31 PM, joanne ta wrote: > > Ok, that's clear now. >> >> Do you use pastie (http://pastie.org/) or gist (https://gist.github.com/ >> )? >> If yes, can you paste following on any of them and reply with link? >> No, I am using t

Re: [Rails] Error of undefined method

2011-06-21 Thread joanne ta
end def show @user= User.find_by_id(params[:id]) end end > > #views > users/index > <%= image_tag url_for(:controller => "/patients", :action => "index"), :width => "25px", :height => "25px"%> > > On Tue,

Re: [Rails] Error of undefined method

2011-06-21 Thread joanne ta
er and display it on the screen. can u help me... thanks :X so much much.. Joanne > > > On Tue, Jun 21, 2011 at 9:22 PM, joanne ta wrote: > >> >> Not sure why it errors out now. >>> Do you get the same error is it a different error this time? >>>

Re: [Rails] Error of undefined method

2011-06-21 Thread joanne ta
eted in 237ms NoMethodError (You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.compact!): app/controllers/users_controller.rb:27:in `block in index' app/controllers/users_controller.rb:25:in `each&#

Re: [Rails] Error of undefined method

2011-06-21 Thread joanne ta
Jun 21, 2011 at 8:35 PM, joanne ta wrote: > >> >> >> Can you paste what you have in your index method? >>> You should not be getting this error because we have already defined @pic >>> as an empty array. >>> >>> >> >> >>>

Re: [Rails] Error of undefined method

2011-06-21 Thread joanne ta
> > >> def index > >> @users= User.all > >> @pic= [] > > You would probably have fewer problems if you observed the Rails > naming conventions; e.g. > > @pictures = [] # plural > > @users.each do |user| > @pictures << Picture.where(:phrase_id => :route , :culture_id > =>user.culture_i

Re: [Rails] Error of undefined method

2011-06-21 Thread joanne ta
e(:phrase_id => :route , :culture_id => > p.culture_id).first > > end > > @pic.compact! > send_data @pic.image, :type => 'image/png', :disposition => 'inline' > > end > > On Tue, Jun 21, 2011 at 8:10 PM, joanne ta wrote: > >

Re: [Rails] Error of undefined method

2011-06-21 Thread joanne ta
ou didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.compact!): app/controllers/patients_controller.rb:29:in `index' what is mean? cuz i want to display picture on the browser too... please help... thank you very much Joanne &g

Re: [Rails] Error of undefined method

2011-06-21 Thread joanne ta
it does not work, it is complaining other error NoMethodError (undefined method `image' for [nil]:Array): app/controllers/patients_controller.rb:27:in `block in index' app/controllers/patients_controller.rb:25:in `each' app/controllers/patients_controller.rb:25:in `index' On Tue, Jun 21, 2

Re: [Rails] Error of undefined method

2011-06-21 Thread joanne ta
> My controller: > > > def index >@users= User.all > > @users.each do |p| > @pic= Picture.where(:phrase_id => :route , :culture_id => > p.culture_id).first > send_data @pic.image, :type => 'image/gif', :disposition => 'inline' > end > end > > in View > > > <%= image_tag u

Re: [Rails] Error of undefined method

2011-06-21 Thread joanne ta
My controller: def index @users= User.all @users.each do |p| @pic= Picture.where(:phrase_id => :route , :culture_id => p.culture_id).first send_data @pic.image, :type => 'image/gif', :disposition => 'inline' end end in View <%= image_tag url_for(:controller => "/users

Re: [Rails] Error of undefined method

2011-06-20 Thread joanne ta
the error is undefined method `image' for nil:NilClass On Mon, Jun 20, 2011 at 2:42 PM, Colin Law wrote: > On 20 June 2011 17:53, joanne ta wrote: > > I have other undefined method when i combine the code above together > > > > <%@users = User.

Re: [Rails] Error of undefined method

2011-06-20 Thread joanne ta
auses undefined method image please give me advices thank you so much Joanne On Mon, Jun 20, 2011 at 12:48 PM, joanne ta wrote: > thanks > > On Mon, Jun 20, 2011 at 12:38 PM, Everaldo Gomes > wrote: > >> Hi! >> >> The method User.all returns an Array of

Re: [Rails] Error of undefined method

2011-06-20 Thread joanne ta
thanks On Mon, Jun 20, 2011 at 12:38 PM, Everaldo Gomes wrote: > Hi! > > The method User.all returns an Array of users, not a single user. > > I think you have to iterate over the array, using each. > > @users.each { |u| u.name } > > Everaldo > > > On Mon, Jun 20, 2011 at 1:33 PM, Yennie wrote:

Re: [Rails] Problems with " wrong number of arguments (2 for 1) (ArgumentError) " and rails server

2011-06-15 Thread joanne ta
you should turn off all the server that you run. and run "rails server"' again ... if you have 2 server on check it maybe one of them is http://0.0.0.0:3000 and other is http://0.0.0.0:3001<http://0.0.0.0:3000/> Joanne On Wed, Jun 15, 2011 at 12:32 PM, joanne ta wrote: &

Re: [Rails] Problems with " wrong number of arguments (2 for 1) (ArgumentError) " and rails server

2011-06-15 Thread joanne ta
1st, what do you use to run the server? netbeans or in ternimal 2011/6/15 Iván Hernández > On 06/15/2011 05:14 PM, joanne ta wrote: > > I think you turn more than one server is on.. > > > On Wed, Jun 15, 2011 at 10:37 AM, Distriker < > ivanhcelrinconelme...@gmail.

Re: [Rails] Problems with " wrong number of arguments (2 for 1) (ArgumentError) " and rails server

2011-06-15 Thread joanne ta
I think you turn more than one server is on.. On Wed, Jun 15, 2011 at 10:37 AM, Distriker wrote: > Hi, I'm trying initialize my local rails server but I haven't can, > because when I write "rails server", show me this message: > > > => Booting WEBrick > => Rails 3.0.3 application starting in de

Re: [Rails] undefined method culture_id

2011-06-14 Thread joanne ta
I run those code in terminal user_instance = User.find(1) => it shows me all the data in the User table and then i run Picture.where(:album_id => :album, :culture_id => user_instance.culture_id).first =>nil On Tue, Jun 14, 2011 at 2:15 PM, Tim Shaffer wrote: > I cannot explain it. You're

Re: [Rails] undefined method culture_id

2011-06-14 Thread joanne ta
i did try the code from above on rails console. it is return nil... so can you explain it please On Tue, Jun 14, 2011 at 12:01 PM, Tim Shaffer wrote: > I'm not sure what you're trying to say. > > When you use "culture_id" in the where clause, it needs to have a value. > This value can come from

Re: [Rails] undefined method culture_id

2011-06-14 Thread joanne ta
user_instance = User.find(1) @pic = Picture.where(:album_id => :album, :culture_id => user_instance.culture_id). first ya, it work but it return nil.. and i cannot take value from Picture model it causes me undefined method image when i call @pic.image On Tue, Jun 14, 2011 at 11:19 AM, Tim Sh

Re: [Rails] undefined method culture_id

2011-06-14 Thread joanne ta
I have culture_id in Picture Model as well On Tue, Jun 14, 2011 at 10:33 AM, Noel wrote: > I think the problem is that you dont have :culture_id => in the > Picture model. Is that right? > > On Tue, Jun 14, 2011 at 7:19 AM, Yennie wrote: > > > > Hi all, > > > > I have an error which said undef

Re: [Rails] how to get the list of users' id

2011-06-13 Thread joanne ta
Sorry, I mean get the list of user id ... cuz my query depends on user.id .. so i want to have a list which is array to go through the album.. On Mon, Jun 13, 2011 at 1:53 PM, Michael Pavling wrote: > On 13 June 2011 18:33, Yennie wrote: > > @id = User.find(:all, :select => 'users.id') >

Re: [Rails] Display picture on the screen

2011-06-11 Thread joanne ta
Hi,, do you have any other options for me.. cuz i really have to do in this way Thanks On Sat, Jun 11, 2011 at 10:07 PM, Hassan Schroeder < hassan.schroe...@gmail.com> wrote: > On Sat, Jun 11, 2011 at 6:02 PM, joanne wrote: > > > I have taken a picture(BLOB) in the DB (sqite3), > > I have a pro

Re: [Rails] Display picture on the screen

2011-06-11 Thread joanne ta
no no no lol On Sat, Jun 11, 2011 at 10:05 PM, Michael Pavling wrote: > On 12/06/2011, joanne wrote: > > I have taken a picture(BLOB) in the DB (sqite3), > > I have a problem to display picture on the screen. > > Can anyone help me and give me some advices please > > Amritpal? Is that you? > >

Re: [Rails] How to display picture on rails

2011-06-10 Thread joanne ta
in view: <%=@patient.image %> in controller @user=Picture.all( :joins => :culture, :conditions => (Phrase.joins(:description))).first and it shows this on the screen, GIF89a � ��ýf�* zd:2eZJ���R �̙ݼ�iZA:0��ޙ��B ���|||^Rc ���

Re: [Rails] error of "undefined method `each' for #"

2011-06-10 Thread joanne ta
i am have any error about the code.. but i cannot show/ display picture on the screen On Fri, Jun 10, 2011 at 10:50 AM, Michael Pavling wrote: > On 10 June 2011 15:47, joanne ta wrote: > > and i have other question.. > > If you have another question, please start another threa

Re: [Rails] error of "undefined method `each' for #"

2011-06-10 Thread joanne ta
Thanks all. :D.. and i have other question.. when i take the image file (BLOD).. i cannot display it .. do you have any idea... Please give me some advice.. thanks \ On Fri, Jun 10, 2011 at 12:19 AM, 3dd13 wrote: > you exectued people.all.first > so the @user only has one picture object

Re: [Rails] error of uninitialized constant

2011-05-30 Thread joanne ta
I did copy and paste those code. anyway, I did found the way to solve the problem . thanks all :P On Mon, May 30, 2011 at 12:17 PM, Colin Law wrote: > On 30 May 2011 17:29, joanne ta wrote: > > I have no idea about that. However, I am pretty sure that the name of DB > is > >

Re: [Rails] error of uninitialized constant

2011-05-30 Thread joanne ta
Hi, I did try it before as well, it still giving me the same error On Mon, May 30, 2011 at 12:34 PM, Tom Meinlschmidt wrote: > > @language = Languages.new > > should be @language = Language.new > > singular. not plural > > > On May 30, 2011, at 18:29 , joanne ta

Re: [Rails] error of uninitialized constant

2011-05-30 Thread joanne ta
I have no idea about that. However, I am pretty sure that the name of DB is correct and my controller is like this class LanguagesController < ApplicationController\ def new @language = Languages.new end end and it points out the problem on "new" app/controllers/language_controller.rb:7