[Rails] [JOBS] Ruby developer needed for tech startup in Santa Monica (casetabs.com)

2015-03-12 Thread Gavin Fabian
Job Description Casetabs is looking for a talented, enthusiastic Ruby on Rails developer who can hit the ground running and is eager to learn and grow into a leadership role. You'll join an existing team, but will have the opportunity to gradually take ownership of application development

[Rails] Looking for Senior RoR developers for leading IaaS Software vendor

2014-11-07 Thread Gavin Marriott
Are you a skilled Ruby on Rails Developer? Then our client would love to hear from you. My client is a global Pre-IPO company with four offices worldwide and is still growing rapidly. This is your chance to work in a fast paced, exciting environment and to get exposure to cutting edge technology

[Rails] Configuring Rails App to handle multiple domains and multiple cookies

2011-05-17 Thread Gavin
I have a rails app which supports multiple domains and each domain may have multiple subdomains. Users visiting mydomain1.com do not receive the same experience as mydomain2.com (although the base behaviour of the apps is the same) Therefore, if a user is logged in to mydomain1.com, it shouldn't

[Rails] Can someone advise me on Rails memory consumption?

2011-04-14 Thread Gavin Morrice
I'm working on a Rails application at the moment which seems to kill the memory on my iMac until I eventually have to restart. I have a 2.66 GHZ processor with 4GB Ram on OSX 10.6. When I boot the rails app, the memory consumption shows the following (ps aux | grep rails): Gavin 726 0.0

[Rails] Re: Can someone advise me on Rails memory consumption?

2011-04-14 Thread Gavin Morrice
, Gavin Morrice ga...@gavinmorrice.comwrote: I'm working on a Rails application at the moment which seems to kill the memory on my iMac until I eventually have to restart. I have a 2.66 GHZ processor with 4GB Ram on OSX 10.6. When I boot the rails app, the memory consumption shows

[Rails] Re: Rails Error: Unable to access log file...

2010-02-21 Thread Gavin Morrice
Hey Kev! You ever find the solution to this issue? Im running three rails apps on my server, all on the same version of rails. One of them runs fine, the other two kick up this error when I try to start them. Any clues would be helpful? Thanks Gav kev...@googlemail.com wrote: I cannot

[Rails] Rails 3 beta: bundle install not installing to the GEM_HOME

2010-02-07 Thread Gavin
I've tried everything I can think of, but bundle install is still installing all new gems into /User/.gems. My GEM_HOME is /usr/local/ lib/ruby/gems/. Is this a bug? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group,

[Rails] Re: Rails 3 beta: bundle install not installing to the GEM_HOME

2010-02-07 Thread Gavin
Yes On Feb 8, 12:59 pm, Erol Fornoles erol.forno...@gmail.com wrote: On Feb 8, 12:29 pm, Gavin gav...@gmail.com wrote: I've tried everything I can think of, but bundle install is still installing all new gems into /User/.gems.  My GEM_HOME is /usr/local/ lib/ruby/gems/.  Is this a bug

[Rails] Accessing dynamic javasript with Ruby

2010-01-08 Thread Gavin
Hey all I'm experimenting with writing a scraper at the moment and have hit a major hump. Part of the DOM is added after the page has loaded via javascript. This means when I make an a request the HTML response I receive back doesn't accurately represent the page. Here's a simplified example:

[Rails] Re: My App doesn't send mails

2009-10-04 Thread Gavin Morrice
doesn't send, it's likely an issue with your login details or with the smtp domain. Also, check that config.action_mailer.raise_delivery_errors = true in production.rb - the error messages could give helpful clues. Hope that helps Gavin Adam Meyer wrote: Hey everyone I put my developed app

[Rails] Re: current best approach for Sending Files (streaming files e.g. images) in rails???

2009-09-21 Thread Gavin
Greg - Check out http://api.rubyonrails.org/classes/ActionController/Streaming.html#M000421 On Sep 20, 10:07 pm, Greg Hauptmann greg.hauptmann.r...@gmail.com wrote: Hi, Q1 - What's the current most popular approach (plugin/gem or otherwise) for sending files / streaming files (e.g. images)

[Rails] Re: silent scope ?

2009-09-19 Thread Gavin
Bingo Bob, Just tried this out on my own machine. Works fine for me. What version of ActiveRecord are you using? On Sep 19, 7:31 am, bingo bob rails-mailing-l...@andreas-s.net wrote: I do this in my model.   named_scope :popular, :order = 'name', :conditions = ['popular_resort = ?', true]

[Rails] Re: silent scope ?

2009-09-19 Thread Gavin
that helps? Gavin http://handyrailstips.com On Sep 19, 7:31 am, bingo bob rails-mailing-l...@andreas-s.net wrote: I do this in my model.   named_scope :popular, :order = 'name', :conditions = ['popular_resort = ?', true]   default_scope :order = 'resort_height DESC, name' By default my

[Rails] Re: silent scope ?

2009-09-19 Thread Gavin
Bob, I'm running Rails 2.3.4 now - so ActiveRecord 2.3.4 This definitely works fine on my machine so I'd guess it was a bug in ActiveRecord 2.3.2. would you consider updating your application to rails 2.3.4? Gavin On Sep 19, 2:40 pm, bingo bob rails-mailing-l...@andreas-s.net wrote: in case

[Rails] Re: silent scope ?

2009-09-19 Thread Gavin
do it. Let me know if that solves the issue? Gavin On Sep 19, 3:07 pm, bingo bob rails-mailing-l...@andreas-s.net wrote: Gavin Morrice wrote: Bob, I'm running Rails 2.3.4 now - so ActiveRecord 2.3.4 This definitely works fine on my machine so I'd guess it was a bug in ActiveRecord

[Rails] Re: put rack folder in vendo folder

2009-09-18 Thread Gavin
you have the option to install gems on the server? Gavin http://handyrailstips.com On Sep 17, 2:42 pm, Snaggy l.cio...@gmail.com wrote: or in general how to put gems there? I have a patch to apply to rack/ methodoverride.rb but I can't find it... how can I copy rack in vendor and not modify

[Rails] Re: Anyone know why __END__ and DATA don't work in Rails?

2009-09-12 Thread Gavin
That makes sense! Thanks for that! On Sep 11, 7:33 pm, pharrington xenogene...@gmail.com wrote: On Sep 11, 12:12 pm, Gavin ga...@thinkersplayground.com wrote: When writing Ruby you have the option to end the file early with __END__. Anything after the __END__ is assigned to a constant

[Rails] Re: Scaffold (form) for single record

2009-09-11 Thread Gavin
= { :price = $150, :battery_life = 8 hours, ... etc... } Maybe this 'virtual class' approach isn't best for your app but perhaps there are other, similar approaches? Gavin On Sep 11, 11:34 am, RVince rvinc...@hotmail.com wrote: I am looking for a sort of scaffolding (because the schema

[Rails] Re: Scaffold (form) for single record

2009-09-11 Thread Gavin
attributes would likely screw up ActiveRecord though, that was silly of me. Perhaps another name like virtual_attributes would be better. On Sep 11, 5:22 pm, Gavin ga...@thinkersplayground.com wrote: Hey RVince Creating tables at runtime sounds really messy - have you considered other

[Rails] Re: Doh! Two versions of Ruby installed!

2009-08-05 Thread Gavin
And I have to say, Phlip, I really think that you are God's Gift to Testing... Phil, do you have a blog? Gavin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send

[Rails] Re: Doh! Two versions of Ruby installed!

2009-08-02 Thread Gavin
Thanks for the suggestions guys I opted for completely removing my old build and all of the gems in favor of the new one (as it was in opt/local as opposed to usr/local) It's been a messy learning experience but all is working fine now,. :S On Aug 2, 5:15 pm, Marnen Laibow-Koser

[Rails] Re: Doh! Two versions of Ruby installed!

2009-08-02 Thread Gavin
to Ubuntu (your Home and End keys will start working, too!) Marnen Laibow-Koser wrote: Huh? Home and End work fine on Mac OS X. So do Ctrl-A and Ctrl-E. Gavin wrote: I opted for completely removing my old build and all of the gems in favor of the new one (as it was in opt/local as opposed to usr

[Rails] Doh! Two versions of Ruby installed!

2009-08-01 Thread Gavin
Hey all I installed FXRuby today using macports and i believe it's installed another copy of Ruby in /opt/local/bin/ruby ls -l `which ruby` # = -rwxr-xr-x 2 root admin 13412 Aug 1 16:50 /opt/local/bin/ruby cat 'which gem` | head -n 1 # = #!/usr/local/bin/ruby This means that when I try to

[Rails] Re: How can I change member action names on routes?

2009-07-30 Thread Gavin
map.resource :search, :controller = search_controller map.suche suche, :controller = search_controller, :action = new Is that what you're looking for? Gavin http://handyrailstips.com On Jul 30, 2:23 pm, John Smith rails-mailing-l...@andreas-s.net wrote: I have some controllers with member

[Rails] Re: How can I change member action names on routes?

2009-07-30 Thread Gavin
think you may have to explicitly state the relative path in your links though, like: %= link_to suchen, /suchen % and %= link_to search, /search % or if you're using locales: %= link_to t('search.name'), /#{t 'search.name'} % hope that helps? Gavin http://handyrailstips.com On Jul 30, 2:53

[Rails] Re: table does not exist

2009-07-29 Thread Gavin
Hey could you post the full error message? Before you do, try rake db:schema:dump If you're schema.rb is exactly how you want the db to be setup then it's a quicker option than building a bunch of separate migrations Gavin http://handyrailstips.com On Jul 29, 3:09 pm, RVince rvinc

[Rails] Re: How to call model that belongs to that controller

2009-07-20 Thread Gavin
the controller that deals with creating and maintaining its records you could try: def get_model self.class.to_s.gsub(Controller,).singularize.constantize end This would return Comment if called in the CommentsController. Hope that helps? Gavin http://handyrailstips.com On Jul 20, 6:35 am, Thriving

[Rails] Re: Model.destroy(array of ids) Bug

2009-07-20 Thread Gavin
Model.destroy(array) end This will raise an error if the ids are not all valid and you'll know to look elsewhere for the root of the problem Hope that helps? Gavin http://handyrailstips.com On Jul 20, 8:59 am, Sandip Ransing san2...@gmail.com wrote: Hello friends ! Model.destroy(array

[Rails] Re: rake error

2009-07-20 Thread Gavin
Hey Could you paste the full trace and error? I doubt this is an error with your gem versions. Gavin http://handyrailstips.com On Jul 20, 6:56 am, jko170 jko...@gmail.com wrote: When I run rake test:units I get this error: 292 tests, 350 assertions, 2 failures, 13 errors rake aborted

[Rails] Re: downloadable docs?

2009-07-20 Thread Gavin
doc:plugins http://handyrailstips.com/tips/11-some-handy-rake-tasks http://handyrailstips.com/tips/12-documenting-your-application-or-plugin-using-rdoc Hope that helps? Gavin On Jul 18, 7:09 pm, ezulo...@gmail.com ezulo...@gmail.com wrote: I havent been able to find any downloadable

[Rails] Re: Testing: be_new_record

2009-07-20 Thread Gavin
be_a_new_record you're essentially saying that the new_record? method should be called and should return true. If you're getting a NoMethod error specifically on be_a_new_record then you might want to ensure you have the latest versions of rspec and rspec-rails. Hope that helps? Gavin http

[Rails] Re: getting the response body

2009-07-14 Thread Gavin
Hey, Why not try: def destroy id = params[:id] render :update do |page| page.alert( THIS TEXT ) if Job.find(:all, :conditions= [type_id=?,id]).size 0 end end Gavin http://handyrailstips.com On Jul 14, 7:21 pm, Mickael Faivre-Macon rails-mailing-l...@andreas- s.net wrote: Hi

[Rails] Re: getting the response body

2009-07-14 Thread Gavin
forgot to add the .destroy() call there :S On Jul 14, 7:40 pm, Gavin ga...@thinkersplayground.com wrote: Hey, Why not try: def destroy   id = params[:id]   render :update do |page|     page.alert( THIS TEXT ) if Job.find(:all, :conditions= [type_id=?,id]).size 0   end end Gavin

[Rails] Re: test problem

2009-07-13 Thread Gavin
Xiahong, The message Test is not a module is the error you want to address. I'd check that your test helper doesn't have include Test or maybe Test.module_eval someplace in it. :S On Jul 13, 3:15 pm, Xiahong Gao gaox...@gmail.com wrote: Hi everyone, I ran into some problems during

[Rails] Re: wiki built on rails

2009-07-10 Thread Gavin
Rookie Love the name :) --~--~-~--~~~---~--~~ 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

[Rails] What's the most RESTful approach here?

2009-07-10 Thread Gavin
: map.resources :items, :collection = { :lost = :get, :found = :get, :broken = :get } def lost @items = Item.lost end ...and so on. Again, quite clear routes and descriptive urls but I'm under the impression that this is a less RESTful approach. Any thoughts? Thanks Gavin

[Rails] Re: What's the most RESTful approach here?

2009-07-10 Thread Gavin
thanks Rob, I also think this is the most simple approach but was really keen to get a 2nd opinion. Gavin On Jul 10, 7:59 pm, Rob Biedenharn r...@agileconsultingllc.com wrote: On Jul 10, 2009, at 12:55 PM, Gavin wrote: Hi all I'm working on an app at the moment and I'm trying

[Rails] Re: Tricky find on associated conditions

2009-07-08 Thread Gavin Morrice
aware that you can include associations in find queries with :include http://api.rubyonrails.org/classes/ActiveRecord/Base.html Off the top of my head, try: Category.all :include = :articles, :order = articles.published_on DESC Let me know if that works Cheers, Gavin http://handyrailstips.com

[Rails] Re: programmatically add a route

2009-07-08 Thread Gavin Morrice
to achieve? Gavin http://handyrailstips.com -- 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 post to this group, send email to rubyonrails-talk

[Rails] Re: Tricky find on associated conditions

2009-07-08 Thread Gavin Morrice
Sweet - wasn't aware of that one Thanks :) Gavin http://handyrailstips.com -- 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 post

[Rails] Re: programmatically add a route

2009-07-08 Thread Gavin Morrice
suppose in the action you'd just call something like def my_action render :partial = params[:partial_name] end not 100% sure if that would work the way you want it to though. Can you elaborate a little more? Gavin http://handyrailstips.com -- Posted via http://www.ruby-forum.com

[Rails] Re: programmatically add a route

2009-07-08 Thread Gavin Morrice
Now that I think about it - don't think this would work render looks through the view folders for your partial - not sure if you'd be able to store them in the public directory :S Gavi http://handyrailstips.com -- Posted via http://www.ruby-forum.com/.

[Rails] Re: ajax update of a table

2009-07-06 Thread Gavin
with more than one format (eg. html and js) then you should use the respond_to method. Otherwise, def my_ajax_action @content = # new content for your table replace id_of_table, render(:partial = partial_name, :locals = {:content = @content } ) end Hope that helps? Gavin http

[Rails] How can I DRY this up?

2009-07-05 Thread Gavin
that require it. I've also tried various combinations with 'eval' and 'send' etc. The validations aren't called :( Can anyone explain why this isn't working and if it's possbile to re- use validations like this? Thanks Gavin --~--~-~--~~~---~--~~ You received this message

[Rails] Re: How can I DRY this up?

2009-07-05 Thread Gavin
Ha! Rookie error Thanks for that Fred. :) On Jul 5, 4:52 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Jul 5, 11:42 am, Gavin ga...@thinkersplayground.com wrote: module CommonValidations   def included(base)     base.class_eval do       validates_presence_of :name

[Rails] Re: How to dynamically load plugin files on every request?

2009-07-04 Thread Gavin
Hi - Why not develop the plugin in your app's /lib directory first? Once you're happy with how it works, you can transfer it over to the plugin's /lib directory That way you don't have to restart the server or change your apps configuration options Gavin http://handyrailstips.com/ On Jul 3

[Rails] Re: Error Messages while entering data in 2 tables with one form

2009-07-04 Thread Gavin
To get rid of the user is invalid, remove validates_associated :user from the UserInfo model Meanwhile, read up on validates_associated: http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#M002461 and make sure you want ot use it here. Gavin http://handyrailstips.com

[Rails] Re: Error Messages while entering data in 2 tables with one form

2009-07-04 Thread Gavin
To get rid of the user is invalid, remove validates_associated :user from the UserInfo model Meanwhile, read up on validates_associated: http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#M002461 and make sure you want ot use it here. Gavin http://handyrailstips.com

[Rails] What's the best way to protect images from the public?

2009-07-03 Thread Gavin
Hey all! Im building an app at the moment in which users can upload images of themselves. The problem is, because these images are stored in the public directory they are open to the public. How can I protect these images but still allow access to them in my views? thanks Gavin

[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Gavin
and checking out pictures they don't have access to. So far, encypting the image name seems to be the only solution. ie- images/8dfa7dg6g82h9dhn9njn23knjkknsdf9.jpg Making it a little more difficult to 'guess' the picture url. Anybody know of a better way to handle this? Gavin On Jul 3, 1:45 pm

[Rails] Re: Error Messages while entering data in 2 tables with one form

2009-07-03 Thread Gavin
be blank you'll need to access it either through %= error_messages_for :user % or @user.errors.on(:first_name) Hope that helps Gavin http://handyrailstips.com On Jul 3, 3:15 pm, Salil Gaikwad rails-mailing-l...@andreas-s.net wrote: Hi All, I want to enter parameters in 2 tables which

[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Gavin
Gavin --~--~-~--~~~---~--~~ 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 rubyonrails-talk

[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Gavin
Alrighty... Was not aware of that. I think in this case it's best to go with the encrpted filename option because I'll might have loads of images to render per page. Thanks for your help guys. Gavin On Jul 3, 3:40 pm, Nicholas Henry nicholas.he...@gmail.com wrote: You can send a file inline

[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Gavin
option because I'll might have loads of images to render per page. ^ apologies for the crap grammar - writing in a hurry today --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to

[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Gavin
Thanks Nicholas, I have used send_file before, but I had no idea that the 'inline' option was available. You've also helped answer the problem I've had with my mp3_player plugin (http://handyrailstips.com/tips/7-playing-mp3-s-on-your-rails- site-with-mp3_player) Thanks again :) Gavin

[Rails] Re: Beginner needs help

2009-07-02 Thread Gavin
What version of Rails are you using? On Jul 2, 1:56 pm, Peter Hermansson rails-mailing-l...@andreas-s.net wrote: Hi, I am trying to follow the book 'Beginning Ruby on Rails e-commerce' examples. When I come to unit testing I get an error message: C:/Ruby/bin/ruby.exe -Ilib;test

[Rails] Re: Determine if a time is within a certain range

2009-06-26 Thread Gavin
yep assuming the timestamp is returning a DateTime object, just call the hour method on that eg. @user.created_at.hour would return an integer that is between 0 and 23 so @user.created_at.hour 0 and @user.created_at.hour 4 Gavin http://handyrailstips.com

[Rails] Re: Ruby on Rails Guides

2009-06-26 Thread Gavin
/toggle Gavin http://handyrailstips.com On Jun 26, 4:52 am, Bharat Ruparel rails-mailing-l...@andreas-s.net wrote: The Rails Guides are at the following address: http://guides.rails.info/ They look really good.  I am particularly interested in learning how to create the nice looking pop-up menu

[Rails] Re: rSpec Newbie Question - Testing controller

2009-06-26 Thread Gavin
Check out http://railscasts.com/episodes/71-testing-controllers-with-rspec Gavin http://handyrailstips.com On Jun 26, 2:33 am, robokos zol...@gmail.com wrote: Hi I am very new to rspec and would like to learn more.  I have googled around and asked in irc with no firm answers. I have

[Rails] Re: how to get date_select to default to unused date?

2009-06-25 Thread Gavin
http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#M001983 see the options list, :default Gavin http://handyrailstips.com On Jun 25, 8:26 pm, dansinker dansin...@gmail.com wrote: I've got a simple form that uses date_select and I'd love to have it automatically choose

[Rails] Re: How do you do this in Rails?

2009-06-24 Thread Gavin
you have a good reason not to, I'd recommend calling your controller method create and letting Rails behave the way it wants to. which 'line feed' do you want to remove? Gavin http://handyrailstips.com On Jun 24, 4:46 pm, JannaB mistressja...@hotmail.com wrote: I have a model (Ups

[Rails] Re: How do you do this in Rails?

2009-06-24 Thread Gavin
Sorry, to answer the original question: My question is, within my UpsController.newchannel(), how do I access the calue of the channel_id that has been selected in the form submission? When rails posts a form to an action, all of the info from the form will be included in a hash called

[Rails] Re: How do you do this in Rails?

2009-06-24 Thread Gavin
: %= f.collection_select :channel_id, @channels, :id, :prompt = true % Hope that helps? Gavin http://handyrailstips.com On Jun 24, 5:58 pm, JannaB mistressja...@hotmail.com wrote: Gavin, Thank you. But suppose I didn't use a named scope -- in that case, how then could I refer to it in my controller

[Rails] Re: How do you do this in Rails?

2009-06-24 Thread Gavin
damn - sorry that should be: %= f.collection_select :channel_id, @channels, :id, :channel, :prompt = true % missed out the text_method param Gavin http://handyrailsitps.com On Jun 24, 6:40 pm, Gavin ga...@thinkersplayground.com wrote: Try using %- end -% instead of % end

[Rails] Re: How do you do this in Rails?

2009-06-24 Thread Gavin
Okay - I'm assuming the action your form posts to is newchannel and you want to access the input from the form in that method? In which case: @channel_id_you_want = params[:ups][:channel_id] That should work? Gavin http://handyrailstips.com On Jun 24, 6:59 pm, JannaB mistressja

[Rails] Re: newbie need help

2009-06-21 Thread Gavin
-20linkCode=as2camp=1789creative=390957creativeASIN=0321445619 Gavin On Jun 20, 3:04 am, rubyrailer23 rubyraile...@gmail.com wrote: Can someone help me get started with ruby on rails?  I searched a lot of tutorials on how to get it started but most are out dated and all doesn't seems to work

[Rails] Re: More than one criteria in business logic...

2009-06-21 Thread Gavin
messages_users. Gavin On Jun 21, 7:05 am, Alexander Trauzzi rails-mailing-l...@andreas- s.net wrote: Hello all! I'm looking to get some help answering a design problem I'm facing.  I'm definitely familiar with how models house all the business logic, but when it RoR, I'm somewhat confused

[Rails] Re: More than one criteria in business logic...

2009-06-21 Thread Gavin
Sorry - That should have been, Message.public, not messages.public. named_scope adds a class method On Jun 21, 9:55 am, Gavin ga...@thinkersplayground.com wrote: Hi, why not add a named scope to messages: named_scope :public, :conditions = {:public = true} So you can call either

[Rails] Re: Making a Keyword Search

2009-06-19 Thread Gavin Morrice
be: Deal.find(:all, :conditions = [item_title LIKE ?, %#{params[:search]}%]) Also - why have you set the value for the text_field_tag to params[:search]? Gavin http://handyrailstips.com -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received

[Rails] Re: Making a Keyword Search

2009-06-19 Thread Gavin Morrice
You're welcome :) I see what you've done with the params[:search] This is used to show the search term in the text-box on the results page. This seems perfectly reasonable Gavin http://handyrailstips.com Aaron Day wrote: I alright I think my problem was that I was using to sources

[Rails] Re: Display a string properly in View

2009-06-18 Thread Gavin
Hi Valentino You shouldn't use puts, for output in the view. You probably want to split the info for each event into seperate cells so your table is well-structured. In which case I'd write a helper_method and throw most of the work into there. If not, you can stop html from collapsing

[Rails] Re: Seems Complex validation --- pls help

2009-06-18 Thread Gavin Morrice
Newb Newb wrote: Hi.. i have a auto complete field for my authority_id field.authority_id field is not mandatory.if the user not fills it will take the default authority id as value. but i want to validate if the user enters invalid authority name into the auto complete text box... i can

[Rails] Re: Display a string properly in View

2009-06-18 Thread Gavin
Sure, From what you've written, it looks like your event model has attributes called dreq_reqno, dreq_status and dreq_create_time and you've joined these together with the event_detail method. If this is the case, you could add a method in on of your helper files (probably EventsHelper) that

[Rails] Re: Routing, use parts of entered url as id / perma

2009-06-18 Thread Gavin Morrice
: Page.find_by_pageTitle(:pageTitle) Also - I would try to stick to the convention of underscoring column names rather than camelCase. Gavin http://handyrailstips.com -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you

[Rails] Re: best way to access audio downloads / audio listen statistics

2009-06-18 Thread Gavin Morrice
and create a model method called add_click. def add_click increment clicks end Then you simply have to call add_click from your controller before redirecting to amazon. Gavin http://handyrailstips.com -- Posted via http://www.ruby-forum.com

[Rails] Re: REGEX HELP

2009-06-18 Thread Gavin Morrice
]/ If it returns nil, there's a space, if not then there's no space. Otherwise I'd go with Colin's approach. Gavin http://handyrailstips.com -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed

[Rails] Re: REGEX HELP

2009-06-18 Thread Gavin Morrice
Haha Fair enough :) Marnen Laibow-Koser wrote: Gavin Morrice wrote: [...] If you're specifically looking for a regepxp that will match any thing that doesn't start with a space then try: /^[^\s]/ I was trying not to spoon-feed the lazy. :) Best, -- Marnen Laibow-Koser http

[Rails] Re: Display RSS Feeds

2009-06-14 Thread Gavin Morrice
% to your view and, if you like, %= auto_discovery_link_tag :rss, rss_path % to the head/head of your layout read about the RSS specifications here: http://cyber.law.harvard.edu/rss/rss.html Hope that helps? Gavin http://handyrailstips.com -- Posted via http://www.ruby-forum.com

[Rails] Re: Display RSS Feeds

2009-06-14 Thread Gavin Morrice
forgot to add... to parse HTML, check out Hpricot http://www.rubyinside.com/parse-xml-quickly-and-easily-with-hpricot-166.html -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[Rails] Re: Reg Expression Help Please?

2009-06-05 Thread Gavin
Hi all Managed to solve this issue with CodeRay The site is now up and running - here is a quick tutorial on how I did it incase anybody else wants to do the same: http://handyrailstips.com/tips/5-styling-your-blog-s-code-to-look-like-your-favorite-text-editor-with-coderay :)

[Rails] Re: Anybody interesting in sharing some rails tips?

2009-06-04 Thread Gavin
@steve Again, sorry for the late reply. I built the site with changes in mind, tips can be updated easily enough so, provided the authors kept them up to date, changes in rails shouldn't be a problem. I'll start scouring the forums for some potential tip info - thanks for the tip! :)

[Rails] Re: how to create dependent record automatically

2009-05-28 Thread Gavin
Vipin, wouldn't it be better moving this out of the controller altogether? If every A should have a B then I'd create an observer - AObserver and add an after_create callback: class AObserver ActiveRecord::Observer def after_create(a) B.create! :a_id = a.id end end

[Rails] Re: how to create dependent record automatically

2009-05-28 Thread Gavin
wrote: On May 28, 6:42 pm, Gavin ga...@thinkersplayground.com wrote: Vipin, wouldn't it be better moving this out of the controller altogether? If every A should have a B then I'd create an observer - AObserver and add an after_create callback: class AObserver ActiveRecord::Observer

[Rails] Re: How to test that a specific error message is thrown

2009-05-28 Thread Gavin
Yep try... def test_should_not_be_valid_without_name user = User.new user.valid? assert_equal user.errors.on(:name), Please enter a name end --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails:

[Rails] Re: How to test that a specific error message is thrown

2009-05-28 Thread Gavin
I'd also recommend checking out rspec. It's a BDD framework that helps you write tests that feel a lot more intuitive than the default rails testing suite. simply install the rspec gem and the rspec-rails gem Specs are written like: describe User do it should not be valid without a name do

[Rails] Re: UserMailer return boolean value

2009-05-28 Thread Gavin
Hey David The only thing I can think of here would be to set action mailer to raise delivery errors in your development and production environments: config.action_mailer.raise_delivery_errors = true and then add something like the following to the method that sends the mail: def

[Rails] Anybody interesting in sharing some rails tips?

2009-05-22 Thread Gavin
. Just create an account and log in. I hope at least some of you find it useful handyrailstips.com Thanks Gavin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send

[Rails] How should I test this?

2009-05-06 Thread Gavin
default_url_options[:host] = mydomain.com def after_create(post) Net::HTTP.get('www.google.com', '/ping?sitemap=' + URI.escape (sitemap_url)) end end How could I write a test for this? Also - how could I disable the actual request while running in test mode? Thanks Gavin

[Rails] Re: How should I test this?

2009-05-06 Thread Gavin
So instead of sending an email after a user is created (for example) from the observer, It would be better to have the controller send it or call a model method to send it? On May 6, 7:19 pm, Phlip phlip2...@gmail.com wrote: Gavin wrote: Firstly, after_create should not call the service

[Rails] Valid hashed passwords

2009-05-01 Thread Gavin
Hey all - just wanted to check if I'm going about this in the right way... I have class User, user has a password Password should only be valid if it's between 6 and 16 chars in length. New user is created if everything is valid and it's stored to the db. After saving to the database, the

[Rails] ordering by join table - is this possible?

2009-05-01 Thread Gavin
Hey all Suppose Post has many comments. Is it possible to call Post.all and order them by the number of comments each has without adding a column 'comments_count' to the Post table? If not, can anyone think of a nicer way of doing it this than: def Post.order_by_comments posts = Post.all

[Rails] Re: ordering by join table - is this possible?

2009-05-01 Thread Gavin
^^ I should add Is it possible to do this in one SQL query? Thanks On May 1, 4:55 pm, Gavin ga...@thinkersplayground.com wrote: Hey all Suppose Post has many comments. Is it possible to call Post.all and order them by the number of comments each has without adding a column

[Rails] Re: Valid hashed passwords

2009-05-01 Thread Gavin
Gottit - thank you both for clearing that up --~--~-~--~~~---~--~~ 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

[Rails] Reg Expression Help Please?

2009-04-29 Thread Gavin
all spaces inside code /code tags to nbsp; I presume using a reg expression is the best way to achieve this, I'm just not sure of how to word an expression to scan for only characters within the html tags. any ideas? Ta Gavin --~--~-~--~~~---~--~~ You received

[Rails] Re: Reg Expression Help Please?

2009-04-29 Thread Gavin
, Tim mcintyre@gmail.com wrote: You don't want to fall into the rat hole of parsing HTML with regexes.  You need a parsing library like hpricot or similar. http://wiki.github.com/why/hpricot good luck! Tim On Apr 29, 11:09 am, Gavin ga...@thinkersplayground.com wrote: Hi all I'm

[Rails] Re: Reg Expression Help Please?

2009-04-29 Thread Gavin
I had planned on formatting the code tags with CSS as you suggested Rob but I also need to wrap specific words in spans to specify their colour --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk

[Rails] Re: Reg Expression Help Please?

2009-04-29 Thread Gavin
Actually... Just found this = http://coderay.rubychan.de/ looks perfect for my needs Thanks for your suggestions guys --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this

[Rails] Re: Not quite a rails question but can anyone advise?

2009-04-23 Thread Gavin
Hey Perry Managed to sort this out. The solution was to add a symlink to libMagickCore.so.1 in /usr/ lib. Thanks a lot for your help :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group.

[Rails] Re: How to have a duplicate copy of params?

2009-04-22 Thread Gavin
You could store it in the session hash temporarily? What is it you're trying to achieve? --~--~-~--~~~---~--~~ 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

[Rails] Re: Not quite a rails question but can anyone advise?

2009-04-21 Thread Gavin
PS - although adding the path to .bash_profile works in the shell, it doesn't work when I start up my app using the facilities provided by my host -is that normal? On Apr 20, 7:59 pm, Wouter de Bie rails-mailing-l...@andreas-s.net wrote: Perry Smith wrote: LD_LIBRARY_PATH may not be

  1   2   >