[Rails] Built in (boolean)? method

2011-06-04 Thread Ants Pants
When creating a boolean attribute in ActiveRecord, you get a ? method for free. Sadly, it's returning false for a true value. Does anyone know what might be going on? From my console (for_charity: true). Same behaviour on Rails 2.3.8 and 2.3.11 ruby-1.8.7-p302 m.for_charity? = false

[Rails] has_many belongs_to in multiple tables

2011-06-04 Thread rajeevkannav
My model association looks like this class User ActiveRecord::Base has_many :correlations has_many :roles, :through = :correlations has_many :skills, :through = :correlations end class Skill ActiveRecord::Base has_many :correlations has_many :roles, :through = :correlations

Re: [Rails] Built in (boolean)? method

2011-06-04 Thread Chris Kottom
The actual representation of any attribute type in Rails will depend on the underlying DBMS as the mapping changes from platform to platform. But if we assume we're talking about SQLite as an example, it uses a SQLite boolean which is actually stored as 0 for FALSE or 1 for TRUE, and both of

[Rails] Re: has_many belongs_to in multiple tables

2011-06-04 Thread rajeevkannav
any idea on this issue ?? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Sy1kTnVURFJJM29K. To post to this group, send email to

Re: [Rails] Re: Creating common method in application ontroller

2011-06-04 Thread Colin Law
On 3 June 2011 18:34, Kevin darkint...@gmail.com wrote: Out of curiosity what should one do if one wants to have a method inherited by all models?  Does rails already have a file for adding methods to the model base class?  Or do we just ram our methods into ActiveModel and call it a day?  I

Re: [Rails] There must be a more elegant way to do this

2011-06-04 Thread Colin Law
On 3 June 2011 17:49, skt stibre...@gmail.com wrote: Hello, I have a bunch of arrays containing records retrieved from the database in separate queries. That can't be changed - I have deal with the different arrays of these records. Each of these records contains, amongst other data fields,

[Rails] rails 3 engine under dynamic scope

2011-06-04 Thread Tomas Celizna
hello, i have a rails 3 engine scoped dynamically like this: scope /:locale do mount MyEngine::Engine = '', :as = 'my_engine' end I can't seem to be able to set my own locale like this: my_engine.page_path(page, :locale = 'de') the path is generated like this: /en/page/12345?locale=de

[Rails] Re: can't run specs with foreign keys?

2011-06-04 Thread Mauro
On 3 June 2011 07:25, Mauro mrsan...@gmail.com wrote: I've set foreign key at database level. When I run rspec it says: permission denied: RI_ConstraintTrigger_111473 is a system trigger: ALTER TABLE categories ENABLE TRIGGER ALL;ALTER TABLE categories_suppliers ENABLE TRIGGER ALL;ALTER

Re: [Rails] Re: Creating common method in application ontroller

2011-06-04 Thread Michael Pavling
On 3 June 2011 23:38, Gordon Yeong anexi...@gmail.com wrote: On Jun 4, 2011 3:42 AM, Michael Pavling pavl...@gmail.com wrote: You can monkey patch Object or Class if you really want... Monkey patches are evil. Evil is a bit strong :-) They can have a place. I've found it invaluable in the

[Rails] Rails 3.1 : Complex database query with Arel 2

2011-06-04 Thread Jérémie Horhant
Hi, I've search for documentations on queries with Arel 2 but there is pretty nothing and all I've found is for Arel 1 so I've run into NoMethodError: undefined method `[]' for #Arel::SelectManager:0x0003f1b820 errors with join syntax. My query is barely simple but involve nesting queries. I

[Rails] Re: Stupid newbie question

2011-06-04 Thread Sta Canovist
Hello guys So, finally I make it work. For those that could experience same problem as me, I can tell how I did. I have a mac 10.5.8 Preinstalled was ruby 1.8.6 and rails version 1.something. Tried different ways but none worked (macports, rvm, locomotive etc). But on the ruby site there is a one

Re: [Rails] Re: Creating common method in application ontroller

2011-06-04 Thread Kevin
Google seems to indicate that one may simply mixin (Is that the correct Ruby terminology.) parts of ActiveModel into any class as one sees fit. For example:http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/ If memory about the way inheritance works in

[Rails] Newbie question

2011-06-04 Thread Fernando Aureliano
Hi, I'm new on rails, and I would like like to know how I do for I get a link on title on a block of code (each), and do this link go to show function and show up. should be something like link_to article.title, article_path? I already tried that and I get broken the page. thanks! --

Re: [Rails] Newbie question

2011-06-04 Thread Valery Kvon
% articles.each do |article| % %= link_to article.title, article_path(article) % % end % Is that you figuring out or I missed something wrong? I'm new on rails, and I would like like to know how I do for I get a link on title on a block of code (each), and do this link go to show

Re: [Rails] Newbie question

2011-06-04 Thread Fernando Aureliano
Nops, thats it. Thanks! =D On Sat, Jun 4, 2011 at 7:25 PM, Valery Kvon adda...@gmail.com wrote: % articles.each do |article| % %= link_to article.title, article_path(article) % % end % Is that you figuring out or I missed something wrong? I'm new on rails, and I would like like to