[Rails] ESI meets ERB, with some odd results

2011-07-20 Thread David A. Black
ars next to "Massaged city". So, strange as it sounds, the variables seem to be differently bound depending on which line is being evaluated. So far I've not been able to puzzle through the sequence of events in such a way as to come up with a way to inject the state and city values into

Re: [Rails] undefined method `inject' for true:TrueClass

2010-09-01 Thread David A. Black
.rb:206:in That's where inject is being called. /Users/mitch/railsprojects/gould_development/app/controllers/public_controller.rb:7:in `home' What does that method look like? David -- David A. Black, Senior Developer, Cyrus Innovation Inc. The Ruby training w

Re: [Rails] Re: FOR or EACH?

2010-08-05 Thread David A. Black
cases where having the flat scope would be so important as to lead me to use for if I didn't have some other reason to (which I don't think I ever have). David -- David A. Black, Senior Developer, Cyrus Innovation Inc. The Ruby training with Black/Brown/McAnally Co

[Rails] [ANN/ADV] The Compleat Rubyist, Philadelphia, PA, October 1-2 2010

2010-07-13 Thread David A. Black
ber 9), $650 regular. There's a 10% discount for groups of 5 or more signing up together. More info and registration links at http://www.compleatrubyist.com -- please let us know if you have any questions. See you in Philly! David -- David A. Black, Senior Developer, Cyrus Innovation I

Re: [Rails] Re: null values...

2010-07-11 Thread David A. Black
On Sun, 11 Jul 2010, RubyonRails_newbie wrote: On 11 July, 21:23, "David A. Black" wrote: On Sun, 11 Jul 2010, RubyonRails_newbie wrote: i'm trying to add comments to a blog. I got it working, but i want to store the user too, so I added the user_id to the blogcomments ta

Re: [Rails] null values...

2010-07-11 Thread David A. Black
er id, but not the body, blogpost id) def comment @blogcomment = Blogcomment.find(:all, :order => "created_at desc") @user = User.find(session[:user_id]) @blogcomment = Blogcomment.create(:id => > params[:body], Do you mean :body there, rather than :id?

Re: [Rails] Ruby Code Return

2010-06-05 Thread David A. Black
n the string "answer".   That's true in Ruby 1.9, but in < 1.9 it will return something else David -- David A. Black, Senior Developer, Cyrus Innovation Inc. THE Ruby training with Black/Brown/McAnally COMPLEAT Coming to Chicago area, June 1

Re: [Rails] regular expression problem

2010-04-27 Thread David A. Black
style notation: "Antigua and Barbuda (+1268)"[/\(\+\d+\)/] # "(+1268)" David -- David A. Black, Senior Developer, Cyrus Innovation Inc. THE Ruby training with Black/Brown/McAnally COMPLEAT Coming to Chicago area, June 18-19, 2010!

[Rails] [ANN/ADV] THE COMPLEAT RUBYIST: training with Black/Brown/McAnally, FL, Jan 2010

2009-10-26 Thread David A. Black
, coming up in January 2010 in Tampa, Florida. Your hosts/instructors will be: * David A. Black * Gregory Brown * Jeremy McAnally We'll be exploring four areas of Ruby language features and techniques, using a workshop-style approach that will include instruction, hands-on exer

[Rails] Re: issue with eager loading in nested routes

2009-10-24 Thread David A. Black
ug dump of a Feature that has no owner_id. David -- The Ruby training with D. Black, G. Brown, J.McAnally Compleat Jan 22-23, 2010, Tampa, FL Rubyist http://www.thecompleatrubyist.com David A. Black/Ruby Power and Light, LLC (http://www.rubypal.com) --~--~-~--~~---

[Rails] Re: How to DRY up these methods?

2009-10-18 Thread David A. Black
The Ruby training with D. Black, G. Brown, J.McAnally Compleat Jan 22-23, 2010, Tampa, FL Rubyist http://www.thecompleatrubyist.com David A. Black/Ruby Power and Light, LLC (http://www.rubypal.com) --~--~-~--~~~---~--~~ You received this message be

[Rails] Re: How to DRY up these methods?

2009-10-17 Thread David A. Black
syms.each do |attr| define_method("#{attr}=") do |value| write_attribute(attr, BLANKS.include?(value) ? nil : value) end end end normalize_fields :address, :city, :country_id end David -- The Ruby training with D. Blac

[Rails] Re: How to DRY up these methods?

2009-10-17 Thread David A. Black
define_method("#{attr}=") do |value| @blanks ||= [0, "0", "", " "] write_attribute(attr, @blanks.include?(value) ? nil : value) end end David -- The Ruby training with D. Black, G. Brown, J.McAnally Compleat Jan 22-23, 2010,

[Rails] Re: circular relationship - habtm

2009-10-03 Thread David A. Black
ment.illustration = some_picture would mean that a given picture belonged to this comment. Or... you could decide that the comment also belongs to the picture it contains, with a distinct foreign key and so forth, though that might feel a bit inside out. David -- David A. Black, Director Ruby P

[Rails] Re: Newbie Trouble with RubyOnRails Bible

2009-09-27 Thread David A. Black
database=mysql If you've already created the app, do the above on a second app, then look at config/database.yml and you'll see the difference in configuration (which you can then adapt for your original app by editing its database.yml). David -- David A. Black, Director Ruby Po

[Rails] Re: Does << create a new record?

2009-09-26 Thread David A. Black
item in DB or not? > I'm having issues. Yes, it will save the item (assuming Order has many Items, Item belongs to Order). If it doesn't, something else is wrong (like the item not being valid). David -- David A. Black, Director Ruby Power and Light, LLC (http://www.rubypal.com) Rub

[Rails] Re: Overriding AR read/write_attribute - Overridden write_attribute Is Never Called

2009-09-24 Thread David A. Black
t;x_with_y"; end p Base.instance_methods(false).sort # does not include "x" include M p Base.instance_methods(false).sort # does include "x" end end AR::Base.new.x After alias_method_chain, AR::Base has an "x" method, so overriding the one in

[Rails] Re: Overriding AR read/write_attribute - Overridden write_attribute Is Never Called

2009-09-24 Thread David A. Black
ecent answer in ruby-talk; there is, indeed an alias_method_chain call involving write_attribute (but not read_attribute) that happens before the initializer is executed. David -- David A. Black, Director Ruby Power and Light, LLC (http://www.rubypal.com) Ruby/Rails training, consulting, mentorin

[Rails] Re: Calling ActionView from uninheriting class

2009-09-24 Thread David A. Black
include that module (or extend an object with it or whatever). David -- David A. Black, Director Ruby Power and Light, LLC (http://www.rubypal.com) Ruby/Rails training, consulting, mentoring, code review Book: The Well-Grounded Rubyist (http://www.manning.com/black2) --~--~-~--~~--

[Rails] Re: Iterators in ruby

2009-09-24 Thread David A. Black
n examine directly in irb or with ri. David -- David A. Black, Director Ruby Power and Light, LLC (http://www.rubypal.com) Ruby/Rails training, consulting, mentoring, code review Book: The Well-Grounded Rubyist (http://www.manning.com/black2) --~--~-~--~~~---~--~--

[Rails] Re: changing the path for map.resources

2009-09-24 Thread David A. Black
Hi -- On Wed, 16 Sep 2009, Felix Schäfer wrote: > > > Am 16.09.2009 um 15:03 schrieb David A. Black: > >> >> On Wed, 16 Sep 2009, steve bell wrote: >> >>> >>> Hi there, just starting to get my head around routes but have a >>> problem tha

[Rails] Re: Accessing the instance variable in another method

2009-09-22 Thread David A. Black
Hi -- See my answer on ruby-talk. David -- David A. Black, Director Ruby Power and Light, LLC (http://www.rubypal.com) Ruby/Rails training, consulting, mentoring, code review Book: The Well-Grounded Rubyist (http://www.manning.com/black2

[Rails] Re: changing the path for map.resources

2009-09-16 Thread David A. Black
t; in the routes.rb file? You need to invert the logic: map.resources :buzzwords, :controller => "terms" David -- David A. Black, Director Ruby Power and Light, LLC (http://www.rubypal.com) Ruby/Rails training, consulting, mentoring, code r

[Rails] Re: Model.valid? = false, the model still saves

2009-09-14 Thread David A. Black
us of that when the record is being saved? You have an after_create hook. Is it possible that that hook is doing something that's making the record invalid after it's already been saved? David -- David A. Black, Director Ruby Power and Lig

[Rails] Re: accesing post array

2009-09-14 Thread David A. Black
;=>"third item"}, "345698067"=>{"description"=>"first item"}, "345698068"=>{"description"=>"second item"}}, "commit"=>"Buy", etc. } So now I can iterate through that hash, getting the

[Rails] Re: After creating an instance of an object, Rails redirects to the index of the object that it :belongs to

2009-09-12 Thread David A. Black
.save Should that be @part.save? If so, I'm not sure why it doesn't blow up entirely, but anyway, that was the first thing that struck my eye. David -- David A. Black, Director Ruby Power and Light, LLC (http://www.rubypal.com) Ruby/Rails training, consulting, mentoring, code review Book:

[Rails] Re: After creating an instance of an object, Rails redirects to the index of the object that it :belongs to

2009-09-12 Thread David A. Black
Hi -- On Sat, 12 Sep 2009, steven_noble wrote: Theory number two: > form_for(@project, @part) do |f| Try this: form_for([...@project, @part]) do |f| (i.e., put them in an array). Theory number one still applies, though, in case you run into further trouble :-) David -- Davi

[Rails] Re: Cleaning up code, eliminating repetition

2009-09-12 Thread David A. Black
I create new action paths to all my resources with the same code. Do you mean you're using the same template for all of these views? I can't quite get my bearings in the sequence of events you're describing. David -- David A. Black, Director Ruby Power and Light, LLC (ht

[Rails] Re: Dynamically call object instances

2009-09-11 Thread David A. Black
phone > end > > where variable was work, for example. But it throws an error "Unexpected > STRING_BEG". If there a way to do what I am doing? Thanks, Yes: @user.send("#{variable}=", @phone) David -- David A. Black | training

[Rails] Re: regular expression matching date, author and agency in string

2009-09-11 Thread David A. Black
parentheses appear, left to right (unless you use (?:) to suppress inclusion of a particular group). David -- David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com Ruby/Rails training, mentoring, consulting, code-review Latest book: The Well-Grounded Rubyist (http://www.manning.c

[Rails] Re: How to deal with this code ?

2009-09-08 Thread David A. Black
27;Book#authors_books' on '#'. Both records must have an id in > order to > create the has_many :through record associating them. Just looking at it quickly I suspect that it's because you're trying to add an Author to an unsaved Book record, and that it's impossi

[Rails] Re: Association extension method

2009-08-28 Thread David A. Black
x27;account.dropzone_id = ?', proxy_owner.id], That should be accounts (plural) I suspect. David -- David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com Ruby/Rails training, mentoring, consulting, code-review Latest book: The Well-Grounded Rubyist (http://www.mann

[Rails] [ADV/REMINDER] Ruby language training in September, w/ Black & Kastner!

2009-08-18 Thread David A. Black
rogramming, and more. OK, back to carbon copy mode :-) *** The training is September 14-17, in Edison, NJ. For more information: http://rubyurl.com/vmzN. And please feel free to contact me with any questions! David -- David A. Black / Ruby Power and

[Rails] Re: Best Practices Question

2009-08-08 Thread David A. Black
h the model classes and objects; those classes and objects have a dimension of depth into the database and so forth. I'll mull it over and report back :-) David -- David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com Q: What's the best way to get a really solid knowledge

[Rails] Re: Best Practices Question

2009-08-08 Thread David A. Black
alized find operation and the delivery into a model, so the controller could just do this: User.mail_to_staff or Notifier.notify_staff But in the simple case, where all you need to do is call a single class method of ActionMailer, there's no reason not to just call it from the contro

[Rails] Re: Best Practices Question

2009-08-07 Thread David A. Black
ontroller and/or User model tests. David -- David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com Q: What's the best way to get a really solid knowledge of Ruby? A: Come to our Ruby training in Edison, New Jersey, September 14-17! Instructors: David A. Black and Erik Kastn

[Rails] Re: Best Practices Question

2009-08-07 Thread David A. Black
... and so on. I don't think it's necessary to wrap it in another layer of modeling. Controllers are allowed to be one step away from model logic, and the methods to deliver are already built into the ActionMailer models. David -- David A. Black / Ruby Power and Light, LLC / http://w

[Rails] Re: Best book to learn RoR??

2009-08-05 Thread David A. Black
g". It's just Ruby, updated for 1.9.1, lots of new stuff, all the old stuff reviewed and revised, no Rails. (I want to emphasize the no Rails thing so that I don't get any disgruntlement when people buy it and find that there's no Rails :-) David -- David A. Black / Ruby Po

[Rails] Re: Best book to learn RoR??

2009-08-05 Thread David A. Black
? It is the "Well Grounded Rubist." Well, strictly speaking: The Well-Grounded Rubyist :-) > everyone knows that you cannot groom a Rubist And even if you could, you probably wouldn't want me as your instructor :-) David -- David A. Black / Ruby Power and Light, LLC / h

[Rails] [ANN] Looking for real-life Rails devel. stories for a book

2009-08-04 Thread David A. Black
er submitting it. If your anecdote is chosen, you'll get a free copy of the book when it comes out! You can submit one or more anecdotes here: http://anecdotes.rubypal.com Let me know if any questions or problems. Thanks! David -- David A. Black / Ruby Power and Light, LLC / http://www.ruby

[Rails] Re: Hash Problem .. + Urgent

2009-07-22 Thread David A. Black
Hi -- On Wed, 22 Jul 2009, Hemant Bhargava wrote: > > David A. Black wrote: >> Hi -- >> >> On Wed, 22 Jul 2009, Hemant Bhargava wrote: >> >>> So no solution .. is it .. ? >> >> Hashes in Ruby 1.9 are ordered by key insertion order. >> >

[Rails] Re: Hash Problem .. + Urgent

2009-07-22 Thread David A. Black
Hi -- On Wed, 22 Jul 2009, Hemant Bhargava wrote: > So no solution .. is it .. ? Hashes in Ruby 1.9 are ordered by key insertion order. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now available: The Well-Grounded

[Rails] [ADV] Black/Kastner Ruby training: for non-beginners?

2009-07-21 Thread David A. Black
bnq which is a case for the affirmative :-) We'd be glad to see you. Contact me any time if you have questions about the course. Thanks! David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now available: The Well-Grounded Rubyist (h

[Rails] Re: make setter private

2009-07-21 Thread David A. Black
Hi -- On Tue, 21 Jul 2009, Frederick Cheung wrote: > > > On Jul 21, 12:02 am, "David A. Black" wrote: >> You can do this and get, by coincidence, something like the desired >> effect: >> >>    def x=(val) >>      super >>      # do oth

[Rails] Re: make setter private

2009-07-20 Thread David A. Black
her stuff end because the call to super will trigger AR::B#method_missing, but the more I look at it and play around with it, the more I think it's way too fragile and too closely couple to the method_missing implementation to use. David -- David A. Black / Ruby Power and Light, LLC Ru

[Rails] Re: make setter private

2009-07-20 Thread David A. Black
Hi -- On Mon, 20 Jul 2009, Learn By Doing wrote: > On Jul 19, 8:03 pm, "David A. Black" wrote: >> Hi -- >> >> >> >> On Sun, 19 Jul 2009, Learn By Doing wrote: >> >>> On Jul 19, 6:39 pm, "David A. Black" wrote: >>>&g

[Rails] Re: noob syntax question

2009-07-20 Thread David A. Black
so forth. So there are two things going on here: the instance variable itself (which is visible in the master template and the partial), and the local variable "foo" in the partial, which you have initialized to the same value as @recent_messages. If you use "recent_messages&quo

[Rails] Re: form_for syntax?

2009-07-20 Thread David A. Black
n't think this is actually a singular/plural issue. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now available: The Well-Grounded Rubyist (http://manning.com/black2) Training! Intro to Ruby, with Black & Kastner, Se

[Rails] Re: form_for syntax?

2009-07-20 Thread David A. Black
starting at the simplest case: if you have this in your routes.rb: map.namespace :admin do |a| a.resources :news end and if @news is a News object, and you've got an admin/news controller, you should be OK. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consult

[Rails] Re: make setter private

2009-07-19 Thread David A. Black
Hi -- On Sun, 19 Jul 2009, Learn By Doing wrote: > > On Jul 19, 6:39 pm, "David A. Black" wrote: >> Hi -- >> >> >> >> On Sun, 19 Jul 2009, Ease Bus wrote: >>> Hi, >> >>> I would like to rename the sett

[Rails] Re: make setter private

2009-07-19 Thread David A. Black
uperclass with a definition for the attribute_A= method? (I'm trying to figure out why you're calling super.) David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now available: The Well-Grounded Rubyist (http://manning.com/black2

[Rails] Re: redefined accessor and return value

2009-07-19 Thread David A. Black
0 >> send(:x=, 20) => "Explicit return value" (Thanks to Rick DeNatale for reminding me of the send thing in a recent ruby-talk thread about this :-) But using send with a = method kind of defeats the purpose. David -- David A. Black / Ruby Power and Light, LLC Ruby/Ra

[Rails] Re: Rails adds send! method to Object?

2009-07-17 Thread David A. Black
ot; meaning that it won't call private methods, I assume -- but that decision was rescinded. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now available: The Well-Grounded Rubyist (http://manning.com/black2) Training! Intro

[Rails] Re: Rails adds send! method to Object?

2009-07-17 Thread David A. Black
e was some question which was the "dangerous" one: the one that included private methods, or the one that didn't. It appears to be gone from Rails, so maybe it was only there during the brief period that it was in 1.9. $ ./script/console Loading development environment (Rails 2.3.2)

[Rails] Re: Use of self in a class

2009-07-17 Thread David A. Black
On Tue, 14 Jul 2009, Rick DeNatale wrote: > > On Tue, Jul 14, 2009 at 8:46 AM, David A. Black wrote: >> > >> I think you're overthinking it. There's no inherent connection between >> constants and class methods. >> >>   module MyMathModule >>

[Rails] Re: Bizarre issue with form builders (merging options and *args).

2009-07-16 Thread David A. Black
I run the above under Ruby 1.9.1: In C#m: [1, 2, 3] sup.rb:22:in `block in ': implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly. (RuntimeError) from sup.rb:27:in `' In other words, you can't do it any m

[Rails] Re: Please help me understand how arrays are translated in rails

2009-07-16 Thread David A. Black
he application itself, so I'm being kind of mechanistic about moving code around (and haven't tested it), but that's at least a broad-stroke way of rethinking it. (Another thing to think about would be whether the calculation method might belong in a class, rather than as a top-level

[Rails] Re: Use of self in a class

2009-07-14 Thread David A. Black
yellow green blue indigo violet } def show_me_the_colors puts "My colors are: #{COLORS.join(", ")}" end end r = Rainbow.new r.show_me_the_colors => My colors are: red, orange, yellow, green, blue, indigo, violet David -- David A. Black / Ruby Power and

[Rails] Re: Use of self in a class

2009-07-13 Thread David A. Black
s object Something. There's a bit more to it, but am I on the right track, in terms of what you're finding confusing? David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now available: The Well-Grounded Rubyist (http://manning

[Rails] Re: Using the model to insert records without a running rails application

2009-07-06 Thread David A. Black
just create hashes directly, and so on. As I say, there are probably more turnkey-ish ways to do it already out there somewhere, though I find it pretty turnkey-ish anyway. There's also rake db:fixtures:load, if you happen to have the sample data you want already in the test fixtures. Davi

[Rails] [ANN/ADV] Training: Intro to Ruby, with Black & Kastner, Sept. 14-17

2009-07-02 Thread David A. Black
o see you there! David, for David and Erik -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now available: The Well-Grounded Rubyist (http://manning.com/black2) Training! Intro to Ruby, with Black & Kastner, September 14-17 More info:

[Rails] [ANN/ADV] "The Well-Grounded Rubyist" now out in paperback

2009-05-12 Thread David A. Black
ay which is why the covers at Manning and Amazon are different at the moment. Same book though :-) [1] http://manning.com/black2 [2] http://tinyurl.com/twgramz -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now available: The Well-Gro

[Rails] Re: What is 'Representational State Transfer'?

2009-04-27 Thread David A. Black
make sure it's OK, I request a representation (probably in the form of an HTML document) to inspect. I've written a bit more about this on these blog posts: http://dablog.rubypal.com/2008/3/23/splitting-hairs-over-resource http://dablog.rubypal.com/2008/4/24/splitting-hairs-over-resource-part-2 specifi

[Rails] Re: RailsConf discounts?

2009-04-23 Thread David A. Black
ublic/register. I believe the pricing is the same as last year. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now out in PDF: The Well-Grounded Rubyist (http://manning.com/black2) "Ruby 1.9: What You Need To Know" Envyca

[Rails] [ANN/ADV] Ruby 1.9 Envycasts: "What You Need To Know", parts 1 and 2

2009-04-22 Thread David A. Black
and Part 2 separately, or get them together for a discount. It's a great way to get your bearings in 1.9 and learn some cool and useful things about strings and encoding, arrays, hashes, enumerators, the new block variable rules, and more. More info at: http://www.envycasts.com Enjoy! David -

[Rails] [ANN/ADV] Ruby training in Atlanta: bring a friend for 1/2 price!

2009-03-17 Thread David A. Black
ance to learn Ruby really well from top-notch instructors. Any questions can be sent to me directly. Thanks! David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2) Ruby

[Rails] [ANN/ADV] Early-bird rate extended for Ruby Training Atlanta

2009-03-09 Thread David A. Black
e on twitter as david_a_black. Ruby Training Atlanta is a joint venture of ENTP and Ruby Power and Light. Looking forward to it! David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Coming in 2009: The Well-Grounded Rubyist (http://mannin

[Rails] [ANN/ADV] Ruby Training in Atlanta, April 1-3!

2009-02-16 Thread David A. Black
& Conference Center. More information, and registration, at: http://www.entp.com/training/atlanta09 and you can email me directly if you have any questions. See you there! David [1] http://www.rubypal.com [2] http://www.entp.com -- David A. Black / Ruby Power and Light, LLC Ruby/Rai

[Rails] Re: 3 use case and the index method

2009-01-21 Thread David A. Black
Hi -- On Wed, 21 Jan 2009, Mohammad Abed wrote: > > Hmm! If the I Sign in to the site. I type the url "mysite.com/galleries" > I get a different error Getting a different error is always a hopeful sign :-) > "undefined method `elseif' for #" It's

[Rails] Re: 3 use case and the index method

2009-01-21 Thread David A. Black
leries One way or another, current_user is returning nil. So you'd have to track that down and fix it, or work around not having a current user in this action. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com

[Rails] Re: 3 use case and the index method

2009-01-21 Thread David A. Black
["visibility_status = ?", true] Then you can do: @galleries = user.visible_galleries or something like that, in the controller, instead of in-lining the business logic of the model. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.

[Rails] Re: how can I "DRYize" this method?

2009-01-21 Thread David A. Black
th_date) (or some small variations on that) you'll get @person.birth_date in the field automatically. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Coming in 2009: The Well-Gro

[Rails] Re: routes question

2009-01-21 Thread David A. Black
t; > map.resources :scanns, :member => { :query => :any } > > In this case, what I want is to show a page with a form for enter data > and later query the database. > > I could make it work with other Rails versions but not with the last one > ... > > What can be wro

[Rails] Re: n00b here, rake error: Expected x.rb to define x

2009-01-20 Thread David A. Black
the file did you define a constant called "Payment_type". What you really want is for Rails to be looking for the constant PaymentType, not Payment_type, and that's why you need to correct your Payment_type references to PaymentType. (And in any case, you need to use the same name

[Rails] Re: Still cant get ActionMailer to work!

2009-01-19 Thread David A. Black
vironment.rb (I did have > it in prodcution.rb) and I now get an error: > > ...s/config/environment.rb:13:NameError: uninitialized constant > ActionMailer Try moving all that ActionMailer lines to the end of the file (after the RailsInitializer.run block is over). David -- David A.

[Rails] Experimental plugin: Rack-based after_filter-ish behavior

2009-01-10 Thread David A. Black
ionality or for speed), except it's already served one of its purposes, namely to help me learn more about the recent controller code and the implementation of the middleware integration. Anyway, if interested, have a look, and let me know if you have any comments. David -- David A. Black / Ruby

[Rails] Re: Thoughts on controllers

2008-12-17 Thread David A. Black
a users controller, I would probably favor a create action in a loans controller, simply because it converges more predictably on the CRUD-related semantics of the resource routing. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Coming

[Rails] Re: Ensuring controller actions have necessary params

2008-11-30 Thread David A. Black
ed and params[:book] is nil, what would you want to happen? And, as a follow-up, does your current error-reporting process already do what you would want to have done in such a case? David -- Rails training from David A. Black and Ruby Power and Light: IN

[Rails] Re: The verdict on Rails scaffolding

2008-11-30 Thread David A. Black
r-the-restless (Or you might be past the point where it's useful, but I thought I'd throw it out there just in case.) David -- Rails training from David A. Black and Ruby Power and Light: INTRO TO RAILS (Jan 12-15), Fort Lauderdale, FL See http://www.rubypal.com for d

[Rails] Re: "You have a nil object" problem driving me crazy!

2008-11-30 Thread David A. Black
ge|%> > <%= side_image.filename.to_s %> ><%end> > > Then Rails allows me to access the attribute directly. I'm certainly > doing something wrong with instance variables assignments/declarations. Is the code you're showing us cut-and-pasted from your vi

[Rails] Re: Books recommendation

2008-11-30 Thread David A. Black
Hi -- On Sat, 29 Nov 2008, DyingToLearn wrote: > > packat wrote: >> If you are to buy a Ruby on Rails book >> right now, which book would you choose? > > Ruby for Rails by David A. Black. It is a bit old, but still extremely > relevant. I found the Ruby parts to be a

[Rails] Re: The verdict on Rails scaffolding

2008-11-30 Thread David A. Black
oincide with what you want, that's great. Otherwise, I'd avoid it. There's no reason to give it first refusal of your development space, just because it's there. David -- Rails training from David A. Black and Ruby Power and Light: INTRO TO RAILS (Jan 12-15), Fort Lauderda

[Rails] [ANN/ADV] Intro and Advanced Rails training in Florida in January

2008-10-29 Thread David A. Black
lines and registration links, at http://www.rubypal.com, and please contact me directly with any questions. I'll also be at RubyConf next week and happy to discuss the training there. David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails January 12

[Rails] Re: what is the difference save() vs save!()

2008-10-04 Thread David A. Black
e method names in your own code. David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails January 12-15 Fort Lauderdale, FL Advancing with RailsJanuary 19-22 Fort Lauderdale, FL * * Co-taught with

[Rails] Re: Removing Non Alpha & Numeric Characters From String

2008-10-02 Thread David A. Black
/\W+/, '-') \W does not include underscore (which is part of the \w class), so if you want to translate underscores you would do: /[\W_]+/ David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails January 12-15 Fort Lauderdale, FL Advancin

[Rails] [ANN/ADV] RubyConf 2008 registration now open!

2008-09-11 Thread David A. Black
he event and the program at: http://2008.rubyconf.org If you have any questions you can write directly to me, or to [EMAIL PROTECTED] See you in Orlando! David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails January 12-15 Fort Lauderdale, FL