Re: [Rails] Active Record question

2015-07-12 Thread Vineeth B S
Ransack https://github.com/activerecord-hackery/ransack Seems like a promising for your usecase. Take a look at it. On Mon, Jul 13, 2015 at 5:40 AM, j...@via.net wrote: > class Asset < ActiveRecord::Base > belongs_to :site > > # class variable :name > > end > > class Site < ActiveRecord::B

[Rails] Re: Re: Don´t work my program :( , please help

2015-07-12 Thread Richard Zanabria
I try with this: class Auto attr_accessor :auto def initialize(auto) @modelo = modelo @precio = precio end def calcular_neto(i) for i in 0 ..i (auto)*0.18 end return auto end auto = Auto.new("Volvo", 19000) neto = auto.calcular_neto(2) puts " Neto: #{neto}" = --

[Rails] Active Record question

2015-07-12 Thread j...@via.net
class Asset < ActiveRecord::Base belongs_to :site # class variable :name end class Site < ActiveRecord::Base has_many :assets # class var x, y, z end Is there a dynamic finder that will traverse the inner join: e.g. Site.find_by_asset_name("xyzzy") Can I get a list of sites where as

Re: [Rails] Re: Don´t work my program :( , please help

2015-07-12 Thread Elizabeth McGurty
Point taken, however I beg to differ... However novice in ROR folks maybe, I think that they bring significance in background. As an educator I have found that appealing to more advanced notions, may be effective. We just have different styles. >From the get go all you needed to suggest was:

[Rails] Re: Don´t work my program :( , please help

2015-07-12 Thread Richard Zanabria
Thanks a todos por sus respuestas -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...

Re: [Rails] Re: Don´t work my program :( , please help

2015-07-12 Thread Colin Law
On 12 July 2015 at 21:58, Elizabeth McGurty wrote: > Okay, I have been following this for a while. I am writing here > respectfully of other contributors. It is just that I see the matter > differently, and I am wondering why none of you have suggested inheritance. I do not think we have been d

[Rails] Re: Don´t work my program :( , please help

2015-07-12 Thread Elizabeth McGurty
Okay, I have been following this for a while. I am writing here respectfully of other contributors. It is just that I see the matter differently, and I am wondering why none of you have suggested inheritance. You have a car. And that car has a model and has a price. Anyway in your applicati

Re: [Rails] Re: Don´t work my program :( , please help

2015-07-12 Thread Colin Law
On 12 July 2015 at 18:41, Richard Zanabria wrote: > > def calcular_neto(i) > for i in 0 ..i > (auto)*0.18 First I suggest that you could use puts within your code to try and work out exactly which bit of code is not working. Usually you will then see your mistake, otherwise you can come ba

[Rails] Re: Don´t work my program :( , please help

2015-07-12 Thread Richard Zanabria
I would like the program receives as parameters the catidad volvo car and demarcates the program calculate the cost plus impuesos (IGV) of the desired amount of cars. I tried to modify the program to try to introduce a "for" to iterate the program depending on how many cars you wish to calculat

Re: [Rails] Re: Don´t work my program :( , please help

2015-07-12 Thread Colin Law
On 12 July 2015 at 09:51, Taras Matsyk wrote: > ... > attr_accessor :auto01, :auto02 > > def calcular_neto > auto01 = 1 Taras, why does the above create a local variable rather than using the accessor= method, whereas x = auto02 picks up @auto02 using the accessor. Colin -- You recei

[Rails] Re: HELP

2015-07-12 Thread Taras Matsyk
Hi Stepa, Have you generated active record model? What controller are you using and how does it look like? In general, You have to send a put request to your controller and pass all data you want to save or you have (depending on behaviour you are trying to achieve). Then you will be using Act

[Rails] Re: Migrating a complete Ruby rails app off heroku!

2015-07-12 Thread Taras Matsyk
Hi OPSPL Goan, drop me a message, I can take a look on that app. -- 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 unsubscribe from this group and stop receiving emails from it, send an email

[Rails] Re: Don´t work my program :( , please help

2015-07-12 Thread Taras Matsyk
Hi Richard, You definitely missed a couple of important topics about OOP and encapsulation in particular. Take a look on attribute accessors in Java (as example), so you could understand how it work in ruby and what attr_accessor key word does. This guy has a nice explanation (cannot say it about