Re: [Rails] Retrieve only values with .select method

2013-11-27 Thread Rogerio Medeiros
Hello men U can use method pluck @interviews.pluck(:created_at) select return array relations 2013/11/27 Cluter Vipic li...@ruby-forum.com Hi Folks, I have a model called Interview. I want retrieve from the model database a list (maybe is much better say array) with some fields.

Re: [Rails] Retrieve only values with .select method

2013-11-27 Thread Rogerio Medeiros
man 2013/11/27 Rogerio Medeiros arge...@gmail.com Hello men U can use method pluck @interviews.pluck(:created_at) select return array relations 2013/11/27 Cluter Vipic li...@ruby-forum.com Hi Folks, I have a model called Interview. I want retrieve from the model database a list

Re: [Rails] Tradução para pt-BR - distance_of_time_in_words

2013-05-27 Thread Rogerio Medeiros
Pq voce nao faz isso no lado cliente? 2013/5/27 Alcelyo Roberto alce...@gmail.com Blz pessoal , Estou com um problema para traduzir o método distance_of_time_in_words, só retorna em ingles ( 3 Days , 4 hours E 35 Minutes ), o resto da app está toda traduzida com I18N, as datas, as

Re: [Rails] Simple refactor?

2013-02-17 Thread Rogerio Medeiros
try [:subject_id, :book_id, :chapter_id, :section_id, :subsection_id, :minisection_id].each do |k| @#{k.to_s} = session[k] if session[k].present? end 2013/2/17 Dave Castellano li...@ruby-forum.com Hi, As I continue learning to program, I am finding things I think can probably be done in a

Re: [Rails] Simple refactor?

2013-02-17 Thread Rogerio Medeiros
[:subsection_id] if session[:subsection_id].present? @minisection_id = session[:minisection_id] if session[:minisection_id].present? 2013/2/17 Rogerio Medeiros arge...@gmail.com try [:subject_id, :book_id, :chapter_id, :section_id, :subsection_id, :minisection_id].each do |k| @#{k.to_s} = session[k

Re: [Rails] Render collection of objects

2012-08-16 Thread Rogerio Medeiros
See u database schema 2012/8/13 Lucas Lima de Souza lucaslim...@gmail.com Hello! I'm trying to render a template this way (below), but the object is nil at _category.html.erb file. index.html.erb %= render @categories % _category.html.erb %=category.name % error: undefined

Re: [Rails] Help with functional test

2012-05-23 Thread Rogerio Medeiros
Guru Cifani lol 2012/5/23 thiagocifani cifani.thi...@gmail.com Are u using mocha? If you are using mocha, I think you should write something like that: mock('post', hash) regards 2012/5/23 Kleber Shimabuku klebershimab...@gmail.com Hi guys, I'm starting to write tests and I writing

Re: [Rails] Chain scopes with OR

2012-05-22 Thread Rogerio Medeiros
simple way to do that. I really want to avoid that, but the best solution that I can see is to duplicate the code of the first two scopes on find_visibles. Thanks, Gustavo On Mon, May 21, 2012 at 10:25 PM, Rogerio Medeiros arge...@gmail.comwrote: try escopo: find_visibles, lambda

Re: [Rails] Chain scopes with OR

2012-05-21 Thread Rogerio Medeiros
try escopo: find_visibles, lambda { find_in_coverage.find_know_missing} 2012/5/21 Gustavo de Sá Carvalho Honorato gustavohonor...@gmail.com The problem of the first solution is that find_in_coverage | find_known_missing combined that way does not return a scope. It returns two arrays each

Re: [Rails] Re: Searching for area code and phone number together

2012-04-24 Thread Rogerio Medeiros
Phone.where(area_code in (?) and number in (?), [440,441,443], [23233233,23231212,12121212]) 2012/4/24 Rafael C. de Almeida almeida...@gmail.com On Apr 24, 5:34 am, vishal singh vishal.singh...@gmail.com wrote: Hi, Phone.find(:all, :conditions=[area_code in ? and number in

Re: [Rails] Re: Searching for area code and phone number together

2012-04-24 Thread Rogerio Medeiros
using concatenation in your query? Walter On Apr 24, 2012, at 1:11 PM, Rafael C. de Almeida almeida...@gmail.com wrote: On Apr 24, 2:55 pm, Rogerio Medeiros arge...@gmail.com wrote: Phone.where(area_code in (?) and number in (?), [440,441,443], [23233233,23231212,12121212]) That would

Re: [Rails] List all Models, Controllers, Views and Tests

2012-04-06 Thread Rogerio Medeiros
Hello in ur app, get models Dir['app/models/*.rb'].map {|f| File.basename(f, '.*').camelize.constantize } def get_model_names_sub Module.constants.select do |constant_name| constant = eval constant_name if not constant.nil? and constant.is_a? Class and

Re: [Rails] new rails project error

2012-04-04 Thread Rogerio Medeiros
http://sachachua.com/blog/p/22184/ 2012/4/4 CC Chen li...@ruby-forum.com Hi all, I install Ruby1.9.2po0 and Rails3.2.3 on RedHat5 When I create a project rails nwe chapter It show below error message: * Installing sqlite3