Re: [Rails] How to find models that have at least one associated has_many

2010-06-11 Thread Michael Pavling
On 11 June 2010 19:26, Rick DeNatale rick.denat...@gmail.com wrote: I'm having a senior moment.  I've done this before but I can't remember how. I want to find all Bars that have at least one Foo, is it: Bar.all(:include = :foos, :conditions = foo.id IS NOT NULL') or something else?

Re: [Rails] How to find models that have at least one associated has_many

2010-06-11 Thread Michael Pavling
On 11 June 2010 20:10, Michael Pavling pavl...@gmail.com wrote:  Bar.all(:joins = :foos).uniq Seems to... quick and dirty test on one of my models: Person.all(:include = :graduations).select { |person| !person.graduations.empty? }.size = 87 Person.all(:include = :graduations).select

Re: [Rails] using :through to get grandchildren objects

2010-06-13 Thread Michael Pavling
On 13 June 2010 15:25, Adam Akhtar li...@ruby-forum.com wrote: How do i achieve what I want, namely to be able to access all the corrections for a given user Create a method on User called corrections and collect up the user's sentences' corrections. class User ActiveRecord::Base  

Re: [Rails] Re: using :through to get grandchildren objects

2010-06-15 Thread Michael Pavling
On 15 June 2010 13:46, Adam Akhtar li...@ruby-forum.com wrote: Can anyone confirm if this is a limitation of the framework? anyone You said in your first post that it *didn't* work trying to do a :though on a :has_one. So as far as I can see you have three choices: 1) Fudge it with a

Re: [Rails] Re: using :through to get grandchildren objects

2010-06-15 Thread Michael Pavling
On 15 June 2010 14:12, Marnen Laibow-Koser li...@ruby-forum.com wrote: Adam Akhtar wrote: Can anyone confirm if this is a limitation of the framework? anyone How do you expect an answer to that if you haven't told us what versions of Ruby and Rails you're using? I can confirm I get

Re: [Rails] Re: using :through to get grandchildren objects

2010-06-15 Thread Michael Pavling
On 15 June 2010 14:23, Frederick Cheung frederick.che...@gmail.com wrote: I can confirm I get the same error trying to do a :has_many :through on a :has_one grandchild in Rails 2.3.5 and Ruby 1.8.7 Although this commit

Re: [Rails] VirtualRails : The FREE Ruby on Rails virtual development platform

2010-06-16 Thread Michael Pavling
On 15 June 2010 22:41, Jerome Fillioux jerome.filli...@gmail.com wrote: A totally free linux (Mint based) VirtualBox image, fully configured, with : I've been very happy using the TurnkeyRails VM (http://www.turnkeylinux.org/rails) which has a very small footprint. I use the IDE on my local

Re: [Rails] Different each iteration

2010-06-16 Thread Michael Pavling
On 16 June 2010 09:19, Greg Ma li...@ruby-forum.com wrote: myList.each_with_something or myList.each_something Do you mean the each_slice method of enumerable? http://ruby-doc.org/core/classes/Enumerable.html -- You received this message because you are subscribed to the Google Groups Ruby

Re: [Rails] Ruby on Rails Analyst/Programmers, Glasgow.

2010-06-16 Thread Michael Pavling
On 16 June 2010 11:37, Deirdre Shell li...@ruby-forum.com wrote: I would like your advice.  I'm helping a young company set up a ROR team from entry level to Senior A/P. Firstly, I'd query why there has been a choice of any technology platform without anyone of experience to decide? Normally,

Re: [Rails] Senior Ruby on Rails Developer Needed! Can you help?

2010-06-16 Thread Michael Pavling
On 16 June 2010 13:01, Paul paul.tur...@darwinrecruitment.com wrote: Can you help?!?! Can you supply some more information before we waste your time with our CVs... Where is this job? This list has an international membership. Is telecommuting acceptable? Is it a permanent or contract job?

Re: [Rails] Off Topic Advice Needed (Time objects)

2010-06-16 Thread Michael Pavling
On 16 June 2010 15:51, Ants Pants antsmailingl...@gmail.com wrote: I don't have a problem with comparing floats, but I might need to find the 10 closest times to the actual event time and 4 of those times could be less than the actual event time and 6 could be higher. As a starting point, IIWM

Re: [Rails] Off Topic Advice Needed (Time objects)

2010-06-16 Thread Michael Pavling
On 16 June 2010 16:45, Ants Pants antsmailingl...@gmail.com wrote: As I have said before, I have no problems with all of that but thanks for the suggestions. To be honest, I don't really understand what you're asking for help with. If you can state your position in different terms, because what

Re: [Rails] Re: URL Hiding

2010-06-16 Thread Michael Pavling
On 16 June 2010 17:28, JuKuen mario...@abv.bg wrote: The idea is generating url`s which will hide what is the database used to store the information and hiding the server side language wrapper. What do *your* URLs look like now that gives away the DB and server-side language? -- You received

Re: [Rails] Forcing helper like link_to to use single quotes

2010-06-16 Thread Michael Pavling
On 16 June 2010 18:51, Sharkie Landshark li...@ruby-forum.com wrote: For example, I want a href='link' rather than a href=link I want to maintain consistency with style. You want to change the correct (according to the xhtml guidelines) double-quotes, to incorrect single quotes? Wouldn't it

Re: [Rails] Need Full-time Senior Ruby Dev with CSS/Jquery skills etc

2010-06-18 Thread Michael Pavling
On 18 June 2010 00:24, Philip Hallstrom phi...@pjkh.com wrote: On Jun 17, 2010, at 4:09 PM, Jan Drake wrote: Subject says it all.  jan_dr...@hotmail.com No... it doesn't... :-) Company?  Location?  On-site or telecommute?  etc... ... salary? -- You received this message because you are

Re: [Rails] Re: Modelling a parent-child relationship

2010-06-18 Thread Michael Pavling
On 18 June 2010 20:10, Marnen Laibow-Koser li...@ruby-forum.com wrote: Michael Satterwhite wrote: A category can be subordinate to another category (it's child - and obviously, the first category is the parent. This is a self-referential many-to-many. Are you *sure* you mean that it's

Re: [Rails] Self Reference, Almost There (I Hope!)

2010-06-20 Thread Michael Pavling
On 20 June 2010 19:12, Michael Satterwhite li...@ruby-forum.com wrote: class CreateRelationships ActiveRecord::Migration  def self.up    create_table :relationships, :id = false do |t|    t.integer :category_id    t.integer :parent_id    t.integer :sort_order      t.timestamps    end  

Re: [Rails] Multiple has_one to same table

2010-06-20 Thread Michael Pavling
On 20 June 2010 20:05, dkmdnielsen donvniel...@gmail.com wrote: Your input/experience appreciated.  I have noticed multiple discussions regarding husband and wife.  But none really end in a this is a the best way to handle things. http://qntm.org/gay Of course, you can stop at level 7 or 8 if

Re: [Rails] rake db:create:all

2010-06-21 Thread Michael Pavling
On 21 June 2010 19:10, Abder-rahman Ali li...@ruby-forum.com wrote: I'm new to Ruby on Rails, and just want to ask, what do we mean when typing this command: $ rake db:create:all It's pretty self-explanatory - it creates all the databases for the application (which are defined in

Re: [Rails] Re: rake db:create:all

2010-06-21 Thread Michael Pavling
On 21 June 2010 19:31, Abder-rahman Ali li...@ruby-forum.com wrote: Michael Pavling wrote: It's pretty self-explanatory - it creates all the databases for the application (which are defined in database.yml) What is mean here by Creating a database. Is it to be built from scratch? Assuming

Re: [Rails] stored procedures and ROR

2010-06-22 Thread Michael Pavling
On 22 June 2010 07:57, Sampath Munasinghe sampathni...@gmail.com wrote: I need to get status of insertions and need to create new userID inside the stored proc. thats why I need to use this. s/need/want/ Nothing there you can't do *without* resorting to SPs. -- You received this message

Re: [Rails] I need to do some code that should be in a controller inside a render partial. How??

2010-06-22 Thread Michael Pavling
On 22 June 2010 07:42, Bob Smith bsm...@gmail.com wrote: The app has a print method in the controller. It does a render partial to loop through each customer. Once there it needs to make lists of attendance for each of the last 3 years to be part of each customers page. This is different for

Re: [Rails] Model Namespace?

2010-06-22 Thread Michael Pavling
On 22 June 2010 15:11, Fernando Brito em...@fernandobrito.com wrote: I have a model called Users and a model called Projects. Now I need to implement a status field to each one of them.  Each User/Project belongs_to a status. If you're implementing states, use a state machine. I use AASM at a

Re: [Rails] Re: Deploy: Developing on Windows Deploying on Linux hosting

2010-06-23 Thread Michael Pavling
On 23 June 2010 06:35, Ali Imran ali.imran.r...@gmail.com wrote: Do Now I need to install Ruby on rails on my virtual machine.. Probably; if it's not in there by default. Or you could use a full-stack that's already prepared for you. There was an email the other day about a Rails VM that was

Re: [Rails] Re: [ANN] ice_cube 0.3.1

2010-06-23 Thread Michael Pavling
I'm just having a look at this, as I've another need for recurrence-tracking. Previously I've used RiCal, but liked the look of IceCube as a little more lightweight. But I'm getting lots of error in my console with Dates being compared to Times, or missing utc_offset method have I missed

Re: [Rails] Re: [ANN] ice_cube 0.3.1

2010-06-23 Thread Michael Pavling
On 23 June 2010 16:53, John Crepezzi john.crepe...@gmail.com wrote: Can you give some more details? ice_cube's times are expressed as Time(s) in Ruby. I'm finding that - although it's not clear from the readme (which just shows end_date). The methods accept Dates as parameters, and seem to

Re: [Rails] How to see the feed of your items

2010-06-23 Thread Michael Pavling
On 23 June 2010 21:43, rodrigo3n rodrig...@gmail.com wrote: Hello everyone, I am a bit confused with the XML markup the controller generates in an rails scaffold, because I can't see it. For example, I create a post scaffold then I go to http://localhost:3000/posts but I can't see the RSS icon

Re: [Rails] Re: I need to do some code that should be in a controller inside a render partial. How??

2010-06-23 Thread Michael Pavling
On 23 June 2010 22:18, Bob Smith bsm...@gmail.com wrote: Thanks. That should work fine.. Is there anything special to do to make the method seen in the view? As long as it's a public method, it will be accessible wherever you have any instance of the class. -- You received this message

Re: [Rails] calculate the number of months difference between two dates

2010-06-24 Thread Michael Pavling
On 24 June 2010 13:29, Tom Mac li...@ruby-forum.com wrote:     Now how to get month difference as 3  (date1 - date2) Googling for ruby months between two dates gleans this as the first result: http://www.francisfish.com/getting_the_number_of_months_between_two_dates_in_rubyrails.htm ...and

Re: [Rails] User Management in Ruby on rails

2010-06-24 Thread Michael Pavling
On 24 June 2010 11:30, musammil mohamed.musam...@gmail.com wrote:  Login Managements There's lots of plugins/gems that handle what you're asking about. Personally, I'd recommend Clearance for user authorisation management. http://ruby-toolbox.com/categories/rails_authentication.html  User

Re: [Rails] Re: How can I improvement concurrence performance?

2010-06-25 Thread Michael Pavling
On 25 June 2010 09:49, Zhao Yi li...@ruby-forum.com wrote: I just tried. If one user run a time-caused job on Rails server. Other users have to wait until it finished. Any chance you're running your Rails server as a single instance of Mongrel? If so, using a Mongrel cluster will help very

Re: [Rails] commenting in new.erb template file

2010-06-27 Thread Michael Pavling
On 27 June 2010 05:35, RailsFan Radha li...@ruby-forum.com wrote: app/views/category/new.erb In this file , i have two line like this !-- plabel for=book_subjectSubject/label: -- !-- %= collection_select(:book,:subject_id,@subjects,:id,:name) %/p -- But, if these two lines are present ,

Re: [Rails] Mongrel rails cluster problem

2010-06-28 Thread Michael Pavling
On 25 June 2010 15:47, Sriram Nyshadham nyshadhamsri...@gmail.com wrote: This list is hopeless. I regret. On Fri, Jun 25, 2010 at 4:12 AM, nyshadhamsri...@gmail.com Please suggest what mistake I am doing. Expecting a reply solving your problem before even half a day has passed, and chastising

Re: [Rails] Relationship problems

2010-06-28 Thread Michael Pavling
On 28 June 2010 10:22, Neil Bye li...@ruby-forum.com wrote: I am trying to send an email using ActionMailer. I am having problems identifying the recipient in email.controller. I want it to be the owner of the current story. It won't accept @story.user because I don't know how to make a

Re: [Rails] Re: Relationship problems

2010-06-28 Thread Michael Pavling
On 28 June 2010 11:37, Neil Bye li...@ruby-forum.com wrote: Michael Pavling wrote: :recipient = @story.user.email_address That gives undefined method `user' for nil:NilClass Well then the It won't accept @story.user because I don't know how to make a relationship between the story model

Re: [Rails] Re: Re: Relationship problems

2010-06-28 Thread Michael Pavling
On 28 June 2010 15:18, Neil Bye li...@ruby-forum.com wrote: Problem is that it won't recognise the Story object. What Story object? In your controller code you don't have one. You use a story key in the params hash, but you haven't populated anything from the database. Is the email address in

[Rails] Downtime notifier

2010-06-28 Thread Michael Pavling
What methods do people use to notify users of upcoming downtime in an application, and for handling requests nicely while scheduled downtime is occurring? My Google-fu is not yielding me anything useful-looking. -- You received this message because you are subscribed to the Google Groups Ruby

Re: [Rails] Downtime notifier

2010-06-28 Thread Michael Pavling
On 28 June 2010 18:19, Peter De Berdt peter.de.be...@pandora.be wrote: And concerning the notification, it's all up to what you personally prefer tbh. One way to go about it is create a Downtime model and with a start and end time, put a before_filter in application_controller.rb that fetches

Re: [Rails] Send_data

2010-06-28 Thread Michael Pavling
On 28 June 2010 21:45, dieinzige dieinz...@me.com wrote: what the hell are u doing, if u have file, u can simplify get link to user, What if the OP needs users to be logged in to view files? Or complete some other approval process. Not much sense having them accessible from the public directory

Re: [Rails] Add a filter on the ERB %= ... %

2010-06-29 Thread Michael Pavling
On 29 June 2010 08:40, Carsten Gehling li...@ruby-forum.com wrote: What I would like is to convert %...@post.user.name% to %=(@post.user.name) rescue ''% No it's not. You shouldn't use exceptions to handle non-exceptional behaviour - and if you know that some posts have had their user

Re: [Rails] Re: Add a filter on the ERB %= ... %

2010-06-29 Thread Michael Pavling
On 29 June 2010 10:24, Carsten Gehling li...@ruby-forum.com wrote: class NilClass  def method_missing(method_name, *args)    ''  end end Overloading method_missing is probable to cause more problems than it fixes :-) That works - if not pretty, then at least it holds my view code together

Re: [Rails] Re: Re: Add a filter on the ERB %= ... %

2010-06-29 Thread Michael Pavling
On 29 June 2010 10:37, Carsten Gehling li...@ruby-forum.com wrote: Yup it is a very neat solution, that I will adapt to. Thanks No worries. I got it from the Refactoring: Ruby Edition book - they call it the introduce null object pattern. Well worth being familiar with the book for loads of

Re: [Rails] Re: Add a filter on the ERB %= ... %

2010-06-29 Thread Michael Pavling
On 29 June 2010 15:24, daphonz cdre...@gmail.com wrote: There is a much easier solution to all of this.  Utilize the try() method that comes with ActiveSupport: I don't see how that's easier than the guard condition that Colin suggested - but either way it ignores that the OP wanted to deal

Re: [Rails] Retaining file path

2010-07-02 Thread Michael Pavling
It's nothing to do with Rails or your coding; html security prevents file input boxes being populated with any default value. On Jul 2, 2010 1:06 PM, Hemant Bhargava li...@ruby-forum.com wrote: Hello All, I am submitting a page which consists of a file type input. So if i select file path after

Re: [Rails] Re: Re: Re: MySQL not Connected ...... *pull hair*

2010-07-02 Thread Michael Pavling
On 2 July 2010 21:37, Hassan Schroeder hassan.schroe...@gmail.com wrote: On Fri, Jul 2, 2010 at 1:29 PM, Norm Scherer normsche...@earthlink.net wrote: As you are running an uncommon environment I would suspect your socket is not where you expect it.  Try adding the line: socket: 

Re: [Rails] Re: Second App in localhost

2010-07-02 Thread Michael Pavling
On 2 July 2010 21:42, RailsFan Radha li...@ruby-forum.com wrote: yes, this is purely for local development purposes only. Of course, when I host it externally, i will have separate domain names. For developing I just use mongrel_rails locally... no messing around with apache configurations, and

Re: [Rails] Looking for some input on career advancement w/ Rails

2010-07-06 Thread Michael Pavling
On 6 July 2010 06:46, Phoenix Rising polarisris...@gmail.com wrote: Hey all, I'm having a tough time finding a good job working with Ruby and Rails, I *know* this stuff reasonably well. The problem is that I often get thrown all kinds of strange theoretical questions out of left field.  For

Re: [Rails] Re: Re: How can I hide my Ruby code?

2010-07-06 Thread Michael Pavling
On 6 July 2010 11:19, Andy Jeffries a...@andyjeffries.co.uk wrote: You can do this (I've had to do it for a client) but it's not simple snip super secret process Very interesting approach. Will file that for future reference. The last step, if you're using Passenger ensure that the last child

Re: [Rails] Re: Is this book dated?

2010-07-07 Thread Michael Pavling
On 7 July 2010 04:35, Marnen Laibow-Koser li...@ruby-forum.com wrote: Ginty wrote: Visual debugging. Doesn't seem to work in NetBeans. -1 Yes it does (in mine at least - Netbeans 6.8 on Ubuntu 9.04, 10.04 and WindowsXP). IIRC You need to install the fast debugger and set a couple of

Re: [Rails] Re: Is this book dated?

2010-07-07 Thread Michael Pavling
On 7 July 2010 11:55, Peter De Berdt peter.de.be...@pandora.be wrote: If TextMate is the tool that works for you , not willing to spend $50 is just foolish to say the least. But if it isn't the tool that works for you, then it's foolish to pay $50 for it. Arguing over which text editor is best

Re: [Rails] Re: Re: Is this book dated?

2010-07-07 Thread Michael Pavling
On 7 July 2010 15:30, Marnen Laibow-Koser li...@ruby-forum.com wrote: visual debugging and the Git plugin might be a good combination if both work. The Git plugin was a bit poor when I used it last (six months ago now...). But the Mercurial plugin works just fine for me! Except...while writing

Re: [Rails] Re: Re: Re: Is this book dated?

2010-07-07 Thread Michael Pavling
On 7 July 2010 16:02, Marnen Laibow-Koser li...@ruby-forum.com wrote: Michael Pavling wrote: See... it's horses for courses... That's actually not what the phrase means; it means more like use the right tool for the job at hand. :) This is the meaning I'd apply to it... http

Re: [Rails] Foreign key

2010-07-08 Thread Michael Pavling
On 8 July 2010 08:41, Rajkumar Surabhi li...@ruby-forum.com wrote: In my application i have 2 tables, 1.logins and 2. credits. how to mention this in model associtations You'll find lots of getting started guides online - no sense rewriting them here:

Re: [Rails] Re: Simple question about submit

2010-07-08 Thread Michael Pavling
On 8 July 2010 09:04, Rob Nichols li...@ruby-forum.com wrote: Marnen Laibow-Koser wrote: No.  form without an action is invalid HTML, so its behavior is undefined.  An action must always be specified. Thank you for that comment on what should happen. However, the fact remains that if you

Re: [Rails] Re: Simple question about submit

2010-07-08 Thread Michael Pavling
On 8 July 2010 09:09, Colin Law clan...@googlemail.com wrote: If you develop a website that does not generate valid html then next week an update to IE may break the website and your clients/users will not be happy. *ahem* one may develop websites with valid html and *this* week, and find the

Re: [Rails] Re: Ruby on rails and android

2010-07-08 Thread Michael Pavling
On 8 July 2010 15:44, Craig White craigwh...@azapple.com wrote: On Thu, 2010-07-08 at 10:36 +0530, shyam mohan wrote:  How to use Rails for android application development...? Is there any tool for that...like iphone application development? Not even remotely connected to ruby or

Re: [Rails] Re: Ruby on rails and android

2010-07-08 Thread Michael Pavling
On 8 July 2010 16:35, Greg Donald gdon...@gmail.com wrote: On Thu, Jul 8, 2010 at 10:23 AM, Michael Pavling pavl...@gmail.com wrote: Or you can use Rhodes/Rhomobile: http://github.com/rhomobile I saw their demo at RailsConf last month.  It only does the most simple form/list stuff, and what

Re: [Rails] Re: Ruby on rails and android

2010-07-09 Thread Michael Pavling
On 8 July 2010 18:27, Greg Donald gdon...@gmail.com wrote: On Thu, Jul 8, 2010 at 10:43 AM, Michael Pavling pavl...@gmail.com wrote: Really? I'm looking at my invoices and beg to disagree. What's the market:// URL to your app(s)? The work I did with Rhodes wasn't for a public app

Re: [Rails] Re: active record question

2010-07-09 Thread Michael Pavling
On 9 July 2010 03:08, RailsFan Radha li...@ruby-forum.com wrote: I come from a db world. Can someone interpret this please, self.questions.reject{|q| q.nil?}.all this explains what .reject does: http://ruby-doc.org/core/classes/Enumerable.html#M003126 So essentially, the line takes the

Re: [Rails] :style error in paperclip

2010-07-09 Thread Michael Pavling
On 9 July 2010 13:26, debadatta debadattaprad...@gmail.com wrote:  :style = {:thumb = '200x200'} is not working for paperclip gem How is it not working? What error message do you get? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To

Re: [Rails] :style error in paperclip

2010-07-09 Thread Michael Pavling
On 9 July 2010 13:47, Colin Law clan...@googlemail.com wrote: On 9 July 2010 13:26, debadatta debadattaprad...@gmail.com wrote: Hi all  :style = {:thumb = '200x200'} is not working for paperclip gem I don't use paperclip, but should that be :styles rather than :style? +1 Basic usage agrees:

Re: [Rails] JOBS - Senior Software Engineer

2010-07-12 Thread Michael Pavling
On 12 July 2010 16:35, Matt m...@lunadatasolutions.com wrote: We are looking to hire a Senior Software Engineer to be part of a team You don't say where in the world you are, or what ball-park the remuneration is... -- You received this message because you are subscribed to the Google Groups

Re: [Rails] Re: What is Rake?

2010-07-14 Thread Michael Pavling
On 15 July 2010 00:02, ct9a anexi...@gmail.com wrote: Wow, you made an RoR app without using rake. You must share with us on how did you do the following without rake. 1) create the databases for the environments (ie dev,test and/or prod) First time I used Rails I created a DB in phpMyAdmin

Re: [Rails] Re: What is Rake?

2010-07-14 Thread Michael Pavling
On 15 July 2010 00:11, Gordon Yeong anexi...@gmail.com wrote: a lot of us here prolly did the hardyards of reading up before asking. This is true. Preeti, the books do cover this quite well. But here's a blog post that does it too: http://jasonseifer.com/2010/04/06/rake-tutorial And as lots

Re: [Rails] create_table

2010-07-15 Thread Michael Pavling
On 15 July 2010 09:38, Abder-Rahman Ali li...@ruby-forum.com wrote: The Rails Way book mentions the following regarding the create_table method: Why do we specify identifiers with symbols instead ofstrings? Both will work, but symbols require one less keystroke. What is meant by: But

Re: [Rails] Ruby - return true if any element in Array satisfies condition but false otherwise

2010-07-16 Thread Michael Pavling
On 16 July 2010 13:48, Ram yourstruly.vi...@gmail.com wrote: Anyone know a function that loops through an array and returns true if any one element satisfies the condition but false if none satisfy the condition? And it should do this in one line. Something like You probably want .detect

Re: [Rails] Ruby - return true if any element in Array satisfies condition but false otherwise

2010-07-16 Thread Michael Pavling
On 16 July 2010 14:19, Andy Jeffries a...@andyjeffries.co.uk wrote: On 16 July 2010 13:51, Michael Pavling pavl...@gmail.com wrote: You probably want .detect Or Enumerable#any? http://apidock.com/ruby/Enumerable/any%3F any_bot_follower = followers.any? { |f| f.bot? } Even better! As it just

Re: [Rails] Re: Association count sorting

2010-07-20 Thread Michael Pavling
On 20 July 2010 04:14, badnaam asitkmis...@gmail.com wrote: Here is *AN* answer if someone else runs into this.. Your solution may certainly work... but is a bit imperative in coding terms, and does introduce an n+1 problem. Rails offers a feature called counter_cache on associations - which

Re: [Rails] Re: Prefix a drop-down with Select Item -- Rails way?

2010-07-20 Thread Michael Pavling
On 20 July 2010 20:08, Marnen Laibow-Koser li...@ruby-forum.com wrote: RichardOnRails wrote:     %= f.label :vendor %br /     % @vendors = Vendor.find( :all, :order=nickname ASC) -% As I and others have told you numerous times: STOP DOING DATABASE ACCESS IN THE VIEW.  You should never have

Re: [Rails] Sorting with related tables

2010-07-27 Thread Michael Pavling
On 27 July 2010 08:59, Mohammed Alenazi vb4...@gmail.com wrote: Hi I have two tables: users and tickets. A user has many tickets which is defined in the model. I want to order the users based on the number of tickets they have. What is the easiest way to do it in Rails without writing to many

Re: [Rails] draw ER Diagrams for models

2010-07-28 Thread Michael Pavling
On 28 July 2010 15:01, Sateesh Kambhamapati li...@ruby-forum.com wrote: Hi I would like to know the relations ship between models by using er diagrams. How it is ?? please suggest me Have a look at Railroad; it might do what you're after. http://railroad.rubyforge.org/ -- You received

Re: [Rails] whyhtml.erb generate a html structure not like it should be?

2010-07-29 Thread Michael Pavling
On 29 July 2010 04:19, Zhenning Guan li...@ruby-forum.com wrote: the HTML.ERB like this, and then it generate a html, it. the table indent not it shoud be, and the second tr also indent not the noraml. why it generate a html like that? Your Ruby code is indented (it has some whitepace infront)

Re: [Rails] Simple View Template Question

2010-07-30 Thread Michael Pavling
On 30 July 2010 03:48, Angel Robert Marquez angel.marq...@gmail.com wrote: % @items.each do |item| % div class=item%= item.id % %= item.record-name % /div % end % I'm trying to render a list of div's with ids item1, item2, item3, If you're specifically after item1 rather than itemitem.id,

Re: [Rails] how to deal with gender

2010-07-31 Thread Michael Pavling
middle_names last_name (although that assumes the WASP model, which the majority of the world has been forced to adjust it's naming models to, arguably wrongly as that may have been) If you want to track whether the name Michael Pavling should be addressed formally as Mr Pavling or as Michael-san

Re: [Rails] Development Environment (Beginners Question)?

2010-08-01 Thread Michael Pavling
On 1 August 2010 06:16, ncage choclab...@gmail.com wrote: is a windows machine good enough to get started with ROR Development? Honestly, without trying to be contentious: no. You *can* get along getting into Rails using Windows (I started that way with InstantRails), but you will discover

Re: [Rails] if then within % % region in html

2010-08-01 Thread Michael Pavling
On 1 August 2010 11:32, Dis Tec li...@ruby-forum.com wrote: I'm returning a value from the db which is true/false and I'd like to convert that to something more meaningful - how can I incorporate an if then into the inline html? You can use conditional checking inline, with normal 'if...else'

Re: [Rails] VIRTUAL RAILSSTILL LEARNING

2010-08-02 Thread Michael Pavling
On 1 August 2010 23:32, Rich d elevenb4...@gmail.com wrote: Where do I go from here?  Im very much a novice at this point and any feedback would be appreciated. You have not created a DB or configured your application to use one (Sqlite is installed, as you're using the VirtuaRails VM).

Re: [Rails] Re: RC routing error that was not in Beta4

2010-08-02 Thread Michael Pavling
On 2 August 2010 08:44, rails.n...@gmail.com rails.n...@gmail.com wrote: Is rails talk not the best spot to ask questions these days? You post what is a quite obscure edge question on a Sunday afternoon, and get stressed that it's not answered by Monday morning? Looking at your question, it

[Rails] OT ... Pot, meet Kettle (was if then within % % region in html)

2010-08-02 Thread Michael Pavling
On 2 August 2010 16:43, Marnen Laibow-Koser li...@ruby-forum.com wrote: I think it's a guru thinking that it's all right to be uncivil if you know enough -- an opinion I do not really subscribe to *cough* *splutter* :-) urm... Marnen, I perceive the vast majority of your posts as veering

Re: [Rails] Re: OT ... Pot, meet Kettle (was if then within % % region in html)

2010-08-02 Thread Michael Pavling
On 2 August 2010 17:15, Marnen Laibow-Koser li...@ruby-forum.com wrote: Michael Pavling wrote: On 2 August 2010 16:43, Marnen Laibow-Koser li...@ruby-forum.com wrote: I think it's a guru thinking that it's all right to be uncivil if you know enough -- an opinion I do not really subscribe

[Rails] OT: how to deal with gender

2010-08-02 Thread Michael Pavling
On 2 August 2010 17:29, Marnen Laibow-Koser li...@ruby-forum.com wrote: Michael Pavling wrote: On 29 July 2010 17:25, bingo bob li...@ruby-forum.com wrote: What's the best way of to deal with gender. i.e. a Person is either Male or Female (generally and fot my purposes I'll stick

Re: [Rails] if then within % % region in html

2010-08-02 Thread Michael Pavling
On 2 August 2010 15:34, Dave Aronson googlegroups2d...@davearonson.com wrote: On Sun, Aug 1, 2010 at 06:52, Michael Pavling pavl...@gmail.com wrote: You can use conditional checking inline, with normal 'if...else' blocks: Though your approach will work, this looks to me like it's probably

Re: [Rails] Any way around using only 1 render per action?

2010-08-02 Thread Michael Pavling
On 2 August 2010 19:26, Bob Smith bsm...@gmail.com wrote: Does anyone know a way around this render( :action=:printone) and return and is the render I'm using totally necessary?? possibly... but I'm not familiar with wicked_pdf, so can't say for sure. Are you following whatever guidelines

Re: [Rails] [JOB] Music Co: Lead RoR Developer, RoR Developer

2010-08-05 Thread Michael Pavling
On 5 August 2010 02:38, Recruiting.IO mackpres...@gmail.com wrote: We have two roles: Team Lead / Director of RoR Development RoR Developer You don't say where; you don't say how much. You don't want us to waste your time with our CVs if we're nowhere near, or it's not in our remuneration

Re: [Rails] Get integers for all months between two dates

2010-08-10 Thread Michael Pavling
On 9 August 2010 18:52, Tim Booher li...@ruby-forum.com wrote: I have the following method which should work in Rails, but I am not sure if this is the best implementation. It looks a little clumsy, given all the good helpers in rails. Am I missing a much better way to do this? As a couple

Re: [Rails] Help geting started

2010-08-11 Thread Michael Pavling
On 11 August 2010 11:13, neigaard sneiga...@gmail.com wrote: Hi I am reading O'Reilly Rails Cookbook, but I can not get the examples working. That's not really a beginners tutorial book - it's more for reference on how to deal with specific problems. You may be better off with a book like

Re: [Rails] The ideal RoR environment

2010-08-13 Thread Michael Pavling
On 13 August 2010 16:34, Bob rpell...@gmail.com wrote: Version-Control - I currently use SVN, but would be interested in hearing arguments for learning Git. SVN is a nightmare when working in teams, remotely, or trying to be agile. You can *make* it work, but only because you change your

Re: [Rails] Re: The ideal RoR environment

2010-08-13 Thread Michael Pavling
On 13 August 2010 17:05, Marnen Laibow-Koser li...@ruby-forum.com wrote: Rails is a Web framework.  Word and Excel documents have no place on the Web -- they do not work well as interchange formats or play nicely with Web browsers.  Do not design your Web applications in such a way that Word

Re: [Rails] Re: Re: The ideal RoR environment

2010-08-13 Thread Michael Pavling
On 13 August 2010 17:21, Marnen Laibow-Koser li...@ruby-forum.com wrote: If a client asks to produce the functionality to export data into the office-application format of their choice, then it's not irresponsible to do exactly that. Yes it is.  If a client asks me that, then it is my

Re: [Rails] Re: The ideal RoR environment

2010-08-13 Thread Michael Pavling
On 13 August 2010 17:18, Marnen Laibow-Koser li...@ruby-forum.com wrote: or if you want to be really cutting edge, look at Fossil (http://fossil-scm.org). How is Fossil cutting-edge? In so far as it is a moderately new development by people who have used other DVCS applications and said to

Re: [Rails] Re: Re: Re: The ideal RoR environment

2010-08-13 Thread Michael Pavling
On 13 August 2010 19:42, Marnen Laibow-Koser li...@ruby-forum.com wrote: There is no alternative to explore. Of course there is.  The application could do all the editing needed and then export the mailshots in some other format. HAL, do the mailmerge... :-) -- You received this message

[OT] Re: [Rails] Re: Re: Re: The ideal RoR environment

2010-08-13 Thread Michael Pavling
On 13 August 2010 19:40, Marnen Laibow-Koser li...@ruby-forum.com wrote: Michael Pavling wrote: [1] I'm currently working on some PHP development, which is running on IIS and MSSQL, because some middle-manager bought an expensive server, which has to be seen to work. It's frustrating

Re: [Rails] Subclassing a model

2010-08-19 Thread Michael Pavling
On 19 August 2010 16:05, Fritz Trapper li...@ruby-forum.com wrote: Is it possible to define a subclass for a model, that defines additional data columns, which are stored in a separate table? Is there any description, how to do this? You can certainly subclass a model. Then the subclass

Re: [Rails] Re: how to perform most viewed

2010-08-19 Thread Michael Pavling
On 19 August 2010 21:18, Philip Hallstrom phi...@pjkh.com wrote: Don't use increment.  It won't do what you want since it's only incrementing the value of the object and then saving it.  Not updating the value in the database. What is saving if not updating in the database? You want to use

Re: [Rails] Re: how to perform most viewed

2010-08-19 Thread Michael Pavling
On 19 August 2010 22:00, Philip Hallstrom phi...@pjkh.com wrote: increment() will *overwrite* the value in the database, not add to it. Ah! That's the bit that wasn't clear to me the way you phrased it before. Reading your post again, I can see what you mean now. Cheers, -- You received this

Re: [Rails] display records for today's date

2010-08-20 Thread Michael Pavling
On 20 August 2010 07:17, Srikanth Jeeva li...@ruby-forum.com wrote: created_at field has datetime in it. how can i search for records in current date? Model.all(:conditions = [created_at BETWEEN ? AND ?, Date.today, Date.tomorrow]) -- You received this message because you are subscribed to

Re: [Rails] MYSQL Result Hash Problem

2010-08-23 Thread Michael Pavling
On 23 August 2010 08:28, Sudheendra Panganamala li...@ruby-forum.com wrote: Hi, Is there any way to iterate through MySQL Result Hash multiple times ? Current Problem: After One iteration, second iteration no records. If you post the code you're having a problem with, then maybe we can make

Re: [Rails] Re: Get a collection using an array of ids, keeping the order

2010-08-23 Thread Michael Pavling
On 23 August 2010 03:18, Robert Head li...@ruby-forum.com wrote: Max Williams wrote: i think i'm going crazy.  Can anyone tell me if this is normal? You are not going crazy. I am! This is a reply to a two-year-old thread... I just wasted 10 minutes trying to find out why I hadn't received the

Re: [Rails] Ruby on Rails IDE

2010-08-24 Thread Michael Pavling
On 24 August 2010 02:25, ZRiddick tcr.t...@gmail.com wrote: Really strange that I cannot find a lot of discussion on a good RoR IDE. Very strange indeed. If you search the archive, you can order by date:

Re: [Rails] Re: Ruby on Rails IDE

2010-08-25 Thread Michael Pavling
On 25 August 2010 20:08, Bill Walton bwalton...@gmail.com wrote: Sorry to jump in mid-stream here, but On Aug 25, 12:29 am, Michael Schuerig mich...@schuerig.de wrote: Last week! I just found it too big and bloated for Rails needs Make sure you're using the Ruby-only version of NB

  1   2   3   4   5   6   7   8   9   10   >