hello, I have a boolean field(is_suit) in a table(I use mysql) and I have Room class for this table.I compare the room entity lie this: <%if room.is_suit? then%> <%=image_tag(''/images/icon/suit.jpg'') %> <%end%> but it shows the image for all the records not just for is_suit=b''1'' but also is_suit=b''0''. where''s the wrong? thanks. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, Bahadır Doğan wrote:> I have a boolean field(is_suit) in a table(I use mysql) and I have Room > class for this table.Could you post the migration that generated this field and the DDL ("explain rooms") that resulted from it? Lutz -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Lutz Horn wrote:> Hi, > > Bahadır Doğan wrote: >> I have a boolean field(is_suit) in a table(I use mysql) and I have Room >> class for this table. > > Could you post the migration that generated this field and the DDL > ("explain rooms") that resulted from it? > > LutzCREATE TABLE `msf`.`rooms` ( `id` int(10) unsigned NOT NULL auto_increment, `odano` int(10) unsigned NOT NULL, `tekyatak` int(10) unsigned NOT NULL, `ciftyatak` int(10) unsigned NOT NULL, `kat` int(10) unsigned NOT NULL, `is_suit` bit(1) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Him Bahadır Doğan wrote:> `is_suit` bit(1) NOT NULL,The possible values of this field are b''1'' and b''0'' for true and false. On the RoR site, these are represented as "\001" and "\000" which are *both true*. If you generate a boolean field using a migration t.column :is_suit, :boolean a column with the MySQL type tinyint(1) is created. For this column, is_suit? works. Lutz -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thanks.that solved the problem. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---