[Rails] Rails on windows

2012-09-19 Thread lyosha
man.. why does everything is so slow on developing on windows? -- 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@googlegroups.com. To unsubscribe from this group, send email to

[Rails] Re: Find the largest value of given 3 values

2012-09-19 Thread Frederick Cheung
On Sep 19, 5:14 am, 7stud -- li...@ruby-forum.com wrote: roh wrote in post #1076535: if we want to get the highest 3 values , then how can we write the code for that .? data = [10, 20, 70, 60, 40, 30] ordered_data = data.sort_by {|num| -num} p ordered_data p ordered_data[0..2] Or

[Rails] Re: Koans question : Don't understand the answers

2012-09-19 Thread Frederick Cheung
On Sep 19, 4:29 am, rubyonrailsx rubyonrai...@gmail.com wrote: As far as i know, ruby use memory  location to generate object's id, normally any dynamic objects(runtime generate objects) will have different object_id, for example foo.object_id not equal with foo.object_id. But, any object

[Rails] Re: Access block scope from AR object

2012-09-19 Thread Frederick Cheung
On Sep 18, 9:55 am, andreacfm acampolon...@gmail.com wrote: I need to create a sort of transaction around some Active Record objects that perform many insert/updates. Example: class MyObject     def transaction block         @my_var = value         self.instance_eval block     end end

Re: [Rails] Re: Access block scope from AR object

2012-09-19 Thread Andrea Campolonghi
Fred. The issue is that I should have to override lots of Model to support it. Ex: Model.create transaction_value: value I would like something more elegant. Andrea On Sep 19, 2012, at 9:41 AM, Frederick Cheung frederick.che...@gmail.com wrote: On Sep 18, 9:55 am, andreacfm

[Rails] mark multiple results

2012-09-19 Thread Werner
Hi... I have a query @users = User. ..some finding code % @users.each do |u| % li%= u.user_id %%= u.user.name %/li Result is something like this: • 1 fred • 1 fred • 9 charlie The result could be 10 different user and/or some could be double or triple. I want to css mark them when

[Rails] Re: pg gem error

2012-09-19 Thread Federico R.
Did you find a solution? I have the same problem since days! :( Saravanan P wrote in post #1076481: Thanks I already installed libpq-dev package and now only i installed postgresql-server-dev-9.1 package. But no luck still same error :( any help! -- Posted via

[Rails] Re: pg gem error

2012-09-19 Thread Federico R.
I am getting crazy about this problem... Basically pg compiles for my system ruby (installed via apt-get), also compiles for my RVM ruby 1.8 BUT when I try to compile it for RVM ruby 1.9 it will fail!!! Why?? Error is always: Can't find the PostgreSQL client library (libpq) -- Posted via

Re: [Rails] Rails on windows

2012-09-19 Thread S Ahmed
just get a Mac, you won't regret it (even a Mac mini if you cannot afford more than $600) On Tue, Sep 18, 2012 at 10:38 PM, lyosha lyosh...@gmail.com wrote: man.. why does everything is so slow on developing on windows? -- You received this message because you are subscribed to the Google

Re: [Rails] Rails on windows

2012-09-19 Thread rails2012
How about Linux/Ubuntu? Is Mac much better than Linux too? On Wednesday, September 19, 2012 7:16:00 AM UTC-7, Gitted wrote: just get a Mac, you won't regret it (even a Mac mini if you cannot afford more than $600) On Tue, Sep 18, 2012 at 10:38 PM, lyosha lyos...@gmail.com

Re: [Rails] NoMethodError with rake db:migrate

2012-09-19 Thread Colin Law
On 18 September 2012 04:00, jose ramirez a30673...@gmail.com wrote: Hi! First of all, this is my first application on Rails, and i'm stuck at a migration. i created a demo app (the demo_app from michael hartl's tutorial) as usual: rails new demo_app, rails generate scaffold User name:string

Re: [Rails] Rails on windows

2012-09-19 Thread jason white
You could start with a VM running Ubuntu to get started with Rails development. A Mac would be far superior, but Ubuntu will get you started. You can do Rails development on Windows, but you may have trouble with certain gems. J On Wed, Sep 19, 2012 at 11:08 AM, rails2012 derek...@hotmail.com

Re: [Rails] Rails on windows

2012-09-19 Thread Peter Hickman
From a purely RoR developer perspective Linux is good. Which you would expect since most RoR applications are deployed to Linux servers - or are you deploying to Windows servers. Its just that Macs are nicer :) As to why your Windows system is slow for developing could be that you have a crappy

[Rails] Re: mark multiple results

2012-09-19 Thread 7stud --
class User attr_accessor :id, :name def initialize(id, name) @id = id @name = name end end charlie = User.new(9, 'Charlie') fred = User.new(1, 'Fred') sally = User.new(3, 'Sally') @users = [ fred, fred, fred, sally, charlie, sally ] user_counts = Hash.new(0)

Re: [Rails] Re: mark multiple results

2012-09-19 Thread Javier Quarite
Maybe this helps: http://api.rubyonrails.org/classes/Enumerable.html#method-i-group_by http://railscasts.com/episodes/29-group-by-month You may do @users.group_by(:id) ... but I'm not sure what you have in your search methods Javier -- You received this message because you are subscribed to

Re: [Rails] Re: pg gem error

2012-09-19 Thread Colin Law
On 19 September 2012 12:04, Federico R. li...@ruby-forum.com wrote: I am getting crazy about this problem... Basically pg compiles for my system ruby (installed via apt-get), also compiles for my RVM ruby 1.8 BUT when I try to compile it for RVM ruby 1.9 it will fail!!! Why?? Which 1.9? Is it

[Rails] Nested Model Mass Assignment Error

2012-09-19 Thread Ari King
Hi, I have a many-to-many relationship via a join table. When I attempt to set the values (i.e. the relationship) in the join table via the Rails console I get the following error, does anyone know what could be wrong? Thanks. Note: I have set attr_accessible -- see Grade model below.

[Rails] Re: multiple modules defining same method included into a class

2012-09-19 Thread John Merlino
Yep: 1.9.3p0 :005 module B 1.9.3p0 :006? def name 1.9.3p0 :007? puts 'b module' 1.9.3p0 :008? end 1.9.3p0 :009? end = nil 1.9.3p0 :010 module C 1.9.3p0 :011? def name 1.9.3p0 :012? puts 'c module' 1.9.3p0 :013? end 1.9.3p0 :014? end = nil 1.9.3p0 :015 class A 1.9.3p0

[Rails] Re: multiple modules defining same method included into a class

2012-09-19 Thread 7stud --
…looking for a module named Rendering in the ActionController namespace, since that is the namesapce that Base is defined in??? module Rendering def greet puts 'hi' end end module ActionController class Base include Rendering end end obj = ActionController::Base.new obj.greet

[Rails] Re: Re: mark multiple results

2012-09-19 Thread 7stud --
Javier Quarite wrote in post #107: Maybe this helps: http://api.rubyonrails.org/classes/Enumerable.html#method-i-group_by http://railscasts.com/episodes/29-group-by-month You may do @users.group_by(:id) ... but I'm not sure what you have in Each user has a unique id, so what does that

[Rails] Re: Re: mark multiple results

2012-09-19 Thread Werner
Hi Javier.. I want to show all entries..they have different other attributes but the same user (name)..thats why group_by is not what I can use. Just want to mark them 'bold' ..so I need a true/false for every result item.. Thanks so far.. Werner On Wednesday, September 19, 2012 8:45:11 PM

Re: [Rails] mark multiple results

2012-09-19 Thread Walter Lee Davis
On Sep 19, 2012, at 3:02 PM, Werner wrote: Hi Javier.. I want to show all entries..they have different other attributes but the same user (name)..thats why group_by is not what I can use. Just want to mark them 'bold' ..so I need a true/false for every result item.. You could do this

[Rails] Re: best practices for Rails serving RESTful JSON services for use by AngularJS, Ember.js, etc.

2012-09-19 Thread gsw
On Tuesday, September 18, 2012 12:28:00 PM UTC-4, gsw wrote: # I have not tested this- just a possibility of something that would use roar-rails which provides consume! and deserialization. def create # another method to implement that relies on proper authorization if

[Rails] StartonRails na [:koshtech] @ Thu 2012-09-20 19:00 - 22:00

2012-09-19 Thread Fernando Kosh
Caros, Aguardo-os amanhã para o StartOnRails. Confirmem presença. -- Forwarded message -- From: Google Calendar calendar-notificat...@google.com Date: 2012/9/19 Subject: Reminder: StartonRails na [:koshtech] @ Thu 2012-09-20 19:00 - 22:00 (RubyOnRio) To: Fernando Kosh

[Rails] path helper help

2012-09-19 Thread S Ahmed
I have a controller: class HomeController ApplicationController def index end def about end def contact end def terms end def privacy end end My routes.rb has: resources :home do member do get 'about' get 'contact' get 'terms' get 'privacy'

Re: [Rails] path helper help

2012-09-19 Thread Everaldo Gomes
Maybe it could be a inflection problem: home.pluralize homes The convention is that a controller is the pluralized name of the model. On Wed, Sep 19, 2012 at 10:32 PM, S Ahmed sahmed1...@gmail.com wrote: I have a controller: class HomeController ApplicationController def index end

Re: [Rails] path helper help

2012-09-19 Thread Fernando Almeida
Use collection instead member http://guides.rubyonrails.org/routing.html#adding-more-restful-actions 2012/9/19 S Ahmed sahmed1...@gmail.com I have a controller: class HomeController ApplicationController def index end def about end def contact end def terms end

Re: [Rails] path helper help

2012-09-19 Thread S Ahmed
Thanks, that worked. Although it doesn't make sense, it isnt' a colleciton so I guessed to use member. BTW, how could I match this: /home/some-name-here Where 'some-name-here' is the parameter (id), and I want to call home#show On Wed, Sep 19, 2012 at 9:56 PM, Fernando Almeida

Re: [Rails] path helper help

2012-09-19 Thread Fernando Almeida
You can use match 'home/:page' = 'home#page' before resources :homeafter # home_controller def page # use params[:page] end Rails routes are matched in the order they are specified, so if you have a resources :photos above a get 'photos/poll' the show

Re: [Rails] path helper help

2012-09-19 Thread Jim Ruther Nill
On Thu, Sep 20, 2012 at 12:13 PM, Fernando Almeida ferna...@fernandoalmeida.net wrote: You can use match 'home/:page' = 'home#page' before resources :homeafter this isn't advisable. home/:page will match home/1 # home_controller def page # use

Re: [Rails] path helper help

2012-09-19 Thread Fernando Almeida
Not if defined before the resource. 2012/9/19 Jim Ruther Nill jvn...@gmail.com On Thu, Sep 20, 2012 at 12:13 PM, Fernando Almeida ferna...@fernandoalmeida.net wrote: You can use match 'home/:page' = 'home#page' before resources :homeafter this

Re: [Rails] path helper help

2012-09-19 Thread Jim Ruther Nill
On Thu, Sep 20, 2012 at 12:32 PM, Fernando Almeida ferna...@fernandoalmeida.net wrote: Not if defined before the resource. i'm not saying that it won't work. i'm saying that it's not good practice. i would've agreed with your method if you added constraints to values of the :page parameter.

Re: [Rails] path helper help

2012-09-19 Thread Fernando Almeida
hummm... really, I agree with you. 2012/9/19 Jim Ruther Nill jvn...@gmail.com On Thu, Sep 20, 2012 at 12:32 PM, Fernando Almeida ferna...@fernandoalmeida.net wrote: Not if defined before the resource. i'm not saying that it won't work. i'm saying that it's not good practice. i

[Rails] append_features(mod)

2012-09-19 Thread John Merlino
append_features(mod) The documentation says: When this module is included in another, Ruby calls append_features in this module, passing it the receiving module in mod. Ruby’s default implementation is to add the constants, methods, and module variables of this module to mod if this module has