[Rails] New Version

2011-02-14 Thread Rick DeNatale
7;t necessarily true. So starting with 0.8.0 the X-properties are represented by an array of property objects. THIS MAY BREAK SOME APPLICATIONS, but the adaptation should be easy. - No changes other than a version number bump. github seems to have failed to notice the commit of

Re: [Rails] Re: Helper to generate css-id from AR model. Do I have alzheimers?

2010-11-26 Thread Rick DeNatale
On Fri, Nov 26, 2010 at 12:42 PM, Frederick Cheung wrote: > > > On Nov 26, 4:13 pm, Rick DeNatale wrote: >> On one of the many Rails projects I've worked on over the years, I >> seem to recall using either a helper or a method on a model to >> generate a css id

[Rails] Helper to generate css-id from AR model. Do I have alzheimers?

2010-11-26 Thread Rick DeNatale
s was part of rails, or from a plugin or something specific to the project. I've failed to find anything like this in the rails docs. Any ideas what this might have been? -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeN

[Rails] Looking for help to fund my Ruby Conf talk.

2010-10-07 Thread Rick DeNatale
ling to contribute. I'll recognize any contributors in my talk, unless they choose anonymity. http://pledgie.com/campaigns/13677 And if anyone has a (preferably long-term) job opportunity for a very experienced OO Programmer and Rubyist, I wouldn't mind hearing from you. -- Rick DeNatale

Re: [Rails] form_for arguments

2010-08-15 Thread Rick DeNatale
t the comment resources isn't nested and it would post to the uri path 'comments' but the way the routes are specified this isn't going to work. Does that make sense? -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twit

Re: [Rails] Re: migration numbers

2010-07-30 Thread Rick DeNatale
ls, it started out as a patch/plugin from some Rails user and eventually got assimilated into the Borg^h^h^h^h^h^h^h^hRails. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/pers

Re: [Rails] kind_of? and superclass

2010-06-25 Thread Rick DeNatale
ance of it's metaclass so it isn't an instance of ApplicationConrtroller or one of it's subclasses. Use the Module#< method UsersController < ApplicationController which returns true if the argument is one of the receivers ancestors, there is also Module#<

[Rails] Quickie blog article about dealing with Bundler, RSpec and Rake

2010-06-25 Thread Rick DeNatale
http://talklikeaduck.denhaven2.com/2010/06/25/making-rspec-rake-and-bundler-play-well-together Note this is for Rails 2.3, not sure if Rails 3 and Rspec 2 would be different. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale

Re: [Rails] Re: Getting note only the class instances but also instances of subclasses on a has_many associations

2010-06-15 Thread Rick DeNatale
hippingCharge', :conditions => {:type => %w(ContainerCharge HandlingContainerCharge ShippingContainerCharge)} -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-den

Re: [Rails] Rails authentication from non-web interface

2010-06-15 Thread Rick DeNatale
app? I'd set the rails app to accept http basic authorization over https, and have the mobile app store the user's password. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person

Re: [Rails] How do you update one object of a has_many :through relationship

2010-06-14 Thread Rick DeNatale
ted_attributes_for :fact_values, :reject_if => :not_updatable_fact_value def not_updatable_fact_value(attrs) attrs[:id] != anointed_fact_value_id end end -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://

Re: [Rails] problem: passing post parameters to a controller

2010-06-11 Thread Rick DeNatale
ly should be parent_id (based on convention assuming that a category belongs_to :parent) So I think you want something like this javascript: post_params="category[name]="+name+"&category[notes]="+notes+"&category[parent_id]="+parent_nid+"&authenticity_token

Re: [Rails] Ruby DateTime arithmetic question

2010-06-11 Thread Rick DeNatale
But since you're using rails and have active support you could do if (current - 10.minutes) > previous HTH -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/902

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

2010-06-11 Thread Rick DeNatale
) or something else? -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -- You received this message because y

Re: [Rails] Re: Newbie question about views folder

2010-05-23 Thread Rick DeNatale
e the name to the ip address so you can use it in the browser urls. Just putting a line in /etc/hosts (or the equivalent if the client is a doze machine) should be enough. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: h

Re: [Rails] Re: What happens when Rails 1.3.5 is installed on top of 2.3.5?

2010-05-23 Thread Rick DeNatale
is the latest version installed. but rails _1.2.6_ will run version 1.2.6 HTH BTW, the OP gave rails version 1.3.5 as a example, as far as I know this a fictitious version since rails went from version 1.2.6 to version 2.0.0 -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github:

Re: [Rails] Re: :body is not being stored in the database

2010-05-22 Thread Rick DeNatale
! :-) > The id gets assigned automatically when a new record is saved, and create saves the record. def comment @user = User.find(session[:user_id]) Blogpost.find(params[:id]).comments.create(:body => params[:body], :user => @user) ... -- Rick DeNatale Blog: http://talkl

Re: [Rails] Re: Multiple Databases using an abstract class - help

2010-05-19 Thread Rick DeNatale
veRecord::Base). So if you only have a single model/table in the database, then just use 1 and not 2, I think. HTH -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-

Re: [Rails] Re: route conflict - help resolving

2010-05-18 Thread Rick DeNatale
thing which I noticed but decided not to mention in trying to attack his question directly. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linked

Re: [Rails] route conflict - help resolving

2010-05-18 Thread Rick DeNatale
t; > Suggestions?  Am I doing this the right way? Maybe if you restricted the format of the topic_id map.forums_show_topic 'forums/:forum_id/:subsection_id/:topic_id', :topic_id => /\d+/, :controller => 'topics', :action => 'show' -- Rick DeNatale Blog:

Re: [Rails] Re: Strange partial

2010-05-17 Thread Rick DeNatale
lace a comment. Login Submitted by: rover You have one tag and two tags, which isn't balanced. This appears to be consistent for each post. I would guess you want that last closing div tag and not the one 4 lines above. I suspect that this is in _post.html.erb HTH --- Rick De

Re: [Rails] redirect_to :create

2010-05-12 Thread Rick DeNatale
e the responsibility of the model, not the controller. You're still updating the record, the difference is what happens when you do. The typical way to do this would be to use something like a before_save callback on the model to save the old version. You might want to look at something li

Re: [Rails] Re: Ahhh .count!

2010-05-12 Thread Rick DeNatale
ny :through associations https://rails.lighthouseapp.com/projects/8994/tickets/1152-support-for-nested-has_many-through-associations There appears to be a plugin, although I've never used it personally. http://github.com/ianwhite/nested_has_many_through -- Rick DeNatale Blog: http://talklikea

Re: [Rails] Re: Why does Object.const_defined?() returns false in this case?

2010-05-12 Thread Rick DeNatale
vs production environment question. Rails in general loads missing constants when referenced. The difference in the development environment is that it cleans them out between requests. Why do you need to use const_defined? Just refer to the class by name and let Rails do it's thing. --

Re: [Rails] Re: Find ALL and then count them up?

2010-05-11 Thread Rick DeNatale
d]) # or some other code to get a particular post david = User.find_by_userid("david") # or some other code to get a particular user some_post.comments.by_user(david).count -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitte

Re: [Rails] Getting data from an ancestor (I think)

2010-05-11 Thread Rick DeNatale
rom the DB representation, and will make changes down the road like changing the database schema to allow multiple artist compilations to be represented, when you will change the belongs_to and has_many relations in Record and Band to either has_and_belongs_to_many or has_many :through associations

Re: [Rails] Re: Find ALL and then count them up?

2010-05-11 Thread Rick DeNatale
mments.size will do a sql query like SELECT count(*) AS count_all FROM `users` WHERE (`users`.account_id = 42) and return the value of count_all HTH -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.

Re: [Rails] best way to model this

2010-05-10 Thread Rick DeNatale
to something like Person since Driver and Passenger are really roles, not entities. class Person < ActiveRecord::Base belongs_to :car end class Car < ActiveRecord::Base belongs_to :driver, :class => ;person has_many :passengers, :class => person end -- Rick DeNatale Blog:

Re: [Rails] Using re to make BidDecimal's more readable using Regexp: problem

2010-05-08 Thread Rick DeNatale
apture the way I want > them to.  I can do it using Ruby to generate a bunch of consecutive > \d{1,5} groups to satisfy my requirement,  but some insightful Regexp > markup is preferable. > > Any ideas? Does this help? BigDecimal("0.141421356237").to_s.scan(/(

Re: [Rails] rake

2010-05-08 Thread Rick DeNatale
/martinfowler.com/articles/rake.html A much more recent tutorial, with some more links at the end: http://jasonseifer.com/2010/04/06/rake-tutorial -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://

Re: [Rails] Re: Re: Controller Tests fail

2010-05-07 Thread Rick DeNatale
s is the publisher of "The RSpec Book", which really should be called the RSpec and Cucumber book, constitutes an endorsement of RSspec and Cucumber. But then as they say in Rome, de gustibus non est disputandum! Use your intellectual seeds as you will. -- Rick DeNatale Blog: http://talkl

Re: [Rails] Re: Rails fails to find models in subfolders

2010-05-07 Thread Rick DeNatale
mespace chain and looks for SampleLog::Sample. Now rails looks for sample_log/sample.rb and finds it, and loads it, and then checks to see whether SampleLog::Sample is now defined, which it isn't because that file defined ::Sample instead. Did you try just moving app/models/sample_log/sampl

Re: [Rails] Re: Input/output error

2010-05-07 Thread Rick DeNatale
, > Nitin. > -- > 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-t...@googlegroups.com. > To unsubscribe from this

Re: [Rails] Re: Using self. Can you newbify this for me?

2010-05-06 Thread Rick DeNatale
the value of the last expression. Which is why ending a method with a variable name doesn't do nothing, as Joshua seems to think, it provides the result of the method. And it IS standard ruby practice. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/r

Re: [Rails] Input/output error

2010-05-06 Thread Rick DeNatale
.13.3/lib/action_view/helpers/capture_helper.rb:108:in > `capture_erb_with_buffer' > That's an OLD version of Rails! Not sure what's going on but it appears that id is being sent to whatever the @plat instance variable is referring to, and that is somehow doing a write. What do

Re: [Rails] Validating the presence of foreign keys /associated objects

2010-05-06 Thread Rick DeNatale
 validates_presence_of :part_id The association name is :part not :part_id so validates_presence_of :part HTH -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-

Re: [Rails] Rails fails to find models in subfolders

2010-05-06 Thread Rick DeNatale
will fix this. If not then show us the walkback you get on the error, it should point to some piece of code which is referring to some constant (name_space::)*Sample -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatal

Re: [Rails] Getting class in /lib folder to see a model (const_missing)?

2010-05-04 Thread Rick DeNatale
:ModelA (NameError)" > > The 'ModelA' is the model I'm trying to access, and 'ClassA' is the > class in /app/lib/class_a.rb. I'm not sure why it seems to think that > ModelA is a part of ClassA, perhaps that's the problem? Shouldn't it be in {

Re: [Rails] using delicious api to retrieve favorite bookmarks

2010-04-30 Thread Rick DeNatale
already use delicious api ? > someone can help me ? > I've never done it myself but http://delicious.com/help/thirdpartytools has a couple of Ruby bindings for the delicious API HTH -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyred

Re: [Rails] Re: habtm relation, cannot populate join table

2010-04-29 Thread Rick DeNatale
tring :hashed_password >      t.string :salt >      t.string :status >      t.string :phone >      t.string :email >      t.integer :station_id >      t.timestamps >    end >  end > >  def self.down >    drop_table :users >  end > end > -- Rick DeNat

Re: [Rails] Find by Date Regardless of Time

2010-04-29 Thread Rick DeNatale
, Date.today]) You might want to look at http://github.com/radar/by_star Just discovered this in the past few days. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/

Re: [Rails] How to match dynamic named routes in Rails 3

2010-04-28 Thread Rick DeNatale
cts/forum/a/b/c"} So instead of breaking it down to an array it just gives you the whole string. Some caveats. 1) Although the existing routes still work since I put this at the end of the routes, unless this is the only controller you have you might want to 'anchor' such urls w

Re: [Rails] habtm relation, cannot populate join table

2010-04-22 Thread Rick DeNatale
o the "stations_users" table.I hav used scaffolding 4 creating these > two models.How can i insert the fields for the join table also when a > user is created? > Can any one help me? Not sure that this is your problem, but I wouldn't be surprised. -- Rick

Re: [Rails] Re: why is ActiveRecord tying to select nonex ID column?

2010-04-22 Thread Rick DeNatale
to metered_usages 2. class MeterUsage belongs_to :service_address belongs_to :metered_service end class ServiceAddress has_many :metered_usages has_many :metered_services, :through => :metered_usages end class MeteredService has_many

Re: [Rails] Re: id upper bounds

2010-04-19 Thread Rick DeNatale
cords won't be evenly distributed because the probability of selecting a particular record is proportional to the difference between it's id and the id of the preceding existing record if any, or 0. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/ruby

Re: [Rails] Is there a way to use @today in a model ??

2010-04-18 Thread Rick DeNatale
the time the association declaration is executed (during class definition time). If you want to use the value at the time you make the query, it needs to be a lambda so that the value gets evaluated each time. HTH -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.co

Re: [Rails] contet_tag :ul question

2010-04-17 Thread Rick DeNatale
il }, content_tag(:li) { link_to("Edit profile", edit_user_path(:current)) }, content_tag(:li) { link_to("Logout", logout_path) }]].join else [content_tag(:li) { link_to("Login", login_path) }, content_tag(:li) { link_to(&quo

Re: [Rails] Re: controller request.body?

2010-04-17 Thread Rick DeNatale
On Fri, Apr 16, 2010 at 9:16 PM, Me wrote: > StringIO#request.body  says StringIO in the log file. > > On Apr 16, 7:40 pm, Rick DeNatale wrote: >> On Fri, Apr 16, 2010 at 8:34 PM, Me wrote: >> > I am trying to get the body of the request coming in to the >> &g

Re: [Rails] controller request.body?

2010-04-16 Thread Rick DeNatale
On Fri, Apr 16, 2010 at 8:34 PM, Me wrote: > I am trying to get the body of the request coming in to the > controller.  request.body is a StringIO object.  I cannot seem to see > what is actually inside it.  any ideas? StringIO#string -- Rick DeNatale Blog: http://talklikeaduck.

[Rails] [ANN] ri_cal version 0.8.7 has been released!

2010-04-16 Thread Rick DeNatale
p.com/projects/30941/tickets/21 exception-when-count-option-used-to-enumerate-non-recurring-event -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn:

[Rails] [ANN] ri_cal 0.8.6 has been released

2010-04-15 Thread Rick DeNatale
-when-count-option-used-to-enumerate-non-recurring-event -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -- You rec

Re: [Rails] Advise sought: Upgrade from Rails 2.0.1 to current

2010-04-15 Thread Rick DeNatale
it this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www

Re: [Rails] People Centric recherche plusieurs déve loppeurs Ruby on Rails

2010-04-15 Thread Rick DeNatale
7/type/6368-job-developpeur-ruby.html/fr/ > J'aime Paris, mais, je suis desolé, j'habite en Caroline du Nord. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-

Re: [Rails] Will rake db:migrate:down VERSION=XXX completely remove that migration from Rails?

2010-04-07 Thread Rick DeNatale
from another branch NOT to be run. But... If you run rake db:migrate:down version=XXX and then remove the file db/migrate/XXX_whatever from your source, the rake task won't see it and it will be gone. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/

Re: [Rails] Re: Switching between Rails 3 and Rails 2

2010-04-06 Thread Rick DeNatale
ets for different projects. http://rvm.beginrescueend.com/ http://www.railway.at/2010/02/13/avoiding-rails-3-dependency-hell-with-rvm/ -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/

Re: [Rails] Re: Superclass mismatch with Rails 3

2010-04-02 Thread Rick DeNatale
T recommended for use with Rails3 beta 2, they want us to use the latest pre-release version of 1.9.2 instead. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale Lin

Re: [Rails] Rails and PHP app under the same domain

2010-04-02 Thread Rick DeNatale
re the rails app ever sees them. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -- You received this me

Re: [Rails] undefined method `each' for "":String

2010-03-31 Thread Rick DeNatale
hod `each' for "":String I'm guessing that you are using Ruby 1.9, Ruby 1.8 had a String#each method, Ruby 1.9 does not, you need to use each_line instead. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale

Re: [Rails] Re: Joining Multiple Tables

2010-03-30 Thread Rick DeNatale
codes table. And it creates the association called code which the error message is complaining about. > On Mar 30, 1:05 pm, Rick DeNatale wrote: >> On Tue, Mar 30, 2010 at 3:03 PM, khagimoto wrote: >> > I'm trying to replicate a join in RoR that I can do in SQL

Re: [Rails] Joining Multiple Tables

2010-03-30 Thread Rick DeNatale
ey => "activity_type" end Activity.find_all_by_user_id(1, :include => :code) This will return a collection of all of the activities for user#1 with attached instances of the code for each activity -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter

Re: [Rails] How to get last url??

2010-03-26 Thread Rick DeNatale
rected to > login page...Now after getting logged in successfully user must be > redirected to the 'Posts' page again so that now he can add new post.. > In a controller you can do request.url -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/Ric

Re: [Rails] Testing best practice

2010-03-18 Thread Rick DeNatale
On Thu, Mar 18, 2010 at 7:57 AM, Rails Fun wrote: > so what is the best way test bed to use for a rails project? > i'm thinking of using Rspec and Cucumber, but where do you do the unit > tests? in Rspec? Yes -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/

Re: [Rails] Re: Re: Re: Three submits, one controller

2010-03-10 Thread Rick DeNatale
o add the comment or > not. A more conventional approach here might be to treat comments as nested resources, and have a Comments controller. http://railscasts.com/episodes/139-nested-resources And if you substitute Story for Article in Ryan's example app in the railscast, it would appe

Re: [Rails] Re: making a generic comment model

2010-03-09 Thread Rick DeNatale
entable rather than attachable as the association name, which I think makes a bit more sense, and is less likely to collide if you decide that one or more of the models which can have comments can also have uploaded files as attachments. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/

Re: [Rails] Attaching, literally, a link

2010-03-08 Thread Rick DeNatale
e: message/external-body; access-type=URL; >                  URL="http://www.foo.com/file"; > > Content-type: text/html > Content-Transfer-Encoding: binary > > THIS IS NOT REALLY THE BODY! Not tested: attachment :content_type => "message/external-body; access-

Re: [Rails] Upgrading rails project - version 1.2.6 to current (2.3.5)

2010-03-07 Thread Rick DeNatale
what point they were introduced. HTH -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -- You received this message because you are

Re: [Rails] Re: RegEx help to detect First and Last name

2010-03-06 Thread Rick DeNatale
the actor would say he HAD two names, and his first name was "Robert" and his last name was "De Niro" -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: h

Re: [Rails] Re: Re: Why all columns of joined table get instantiated as String?

2010-03-05 Thread Rick DeNatale
On Fri, Mar 5, 2010 at 2:12 PM, Jack Shanter wrote: > Rick Denatale wrote: >> Why not >> >> pages = Page.all(:include => :book) > > I usually need to filter by, let's say, a certain library: > > @pages = Page.all( >  :select => 'pag

Re: [Rails] RegEx help to detect First and Last name

2010-03-05 Thread Rick DeNatale
n a block of text. Some other cases to consider John Phillip Sousa (or if you're a kid a heart John Jacob Jingelheimer Smith) not to mention Spanish names which can have MANY parts. Robert De Niro Jesus Mary and Joseph Surnames with origins in some languages don't start with a capita

Re: [Rails] Re: undefined method `build' for nil:NilClass

2010-03-05 Thread Rick DeNatale
On Fri, Mar 5, 2010 at 8:12 AM, mac wrote: > 3)  def new >   �...@content_master = ContentMaster.new >   �...@metadata = @content_master.metadata.build @metadata = @content_master.build_metadata > -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http:/

Re: [Rails] Re: Why all columns of joined table get instantiated as String?

2010-03-05 Thread Rick DeNatale
On Fri, Mar 5, 2010 at 9:07 AM, Jack Shanter wrote: > Thanks, Fred. I suppose I'll stick with views and conversions. Why not pages = Page.all(:include => :book) pages.first.book.year -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickD

Re: [Rails] Re: Re: Works in Ruby but not in Rails More info

2010-03-04 Thread Rick DeNatale
rd-code comment.user_id to a known value to > check that when there *is* a user on the comment, the view displays > correctly. Then you can go back and make sure the comment is being > built properly. It might also be an ideal to add validates_presence_of :user to the comment model and

Re: [Rails] MatchData providing unexpected result

2010-02-28 Thread Rick DeNatale
y ideas? m[0] doesn't return the string being searched, it returns everything which the entire pattern matched. In the first case /(.+[aiu])(.+[aiu])(.+[aiu])(.+[aiu])/i entirely matches "Fujiyama" in the second case /noun/i only matches a portion of the string, so that's wh

Re: [Rails] website down?

2010-02-25 Thread Rick DeNatale
what could have happened? -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -- You received this message because you are subscribed to th

Re: [Rails] Rails acts_as_* plugins, with parameters

2010-02-25 Thread Rick DeNatale
>    end > >    module ClassMethods >      def acts_as_item(options = {}) >        configuration = {:option=>:value} >        class_eval { >          include InstanceMethods > >          def self.configuration I think you want this to be def configuration

Re: [Rails] Active Record - Select by multiple days of week

2010-02-24 Thread Rick DeNatale
kday IN ?", weekdays_selected) If it were me I might think about tweaking this a bit and use 7 instead of 0 for any day, since Ruby's Date and Time use 0 for Sunday through 6 for Saturday. Caveat, none of the above code has been tested, and I've only had two sips of coffee this

Re: [Rails] Re: how to validate uniqueness across multiple columns in ActiveRecord?

2010-02-22 Thread Rick DeNatale
tiveRecord::StatementInvalid exception, which you'll need to rescue and do something like telling the user of the conflict so that he can resolve it. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/pers

Re: [Rails] Re: Re: Re: Passing paramter but without GET

2010-02-22 Thread Rick DeNatale
ction_id/add_date/:date', :controller => 'actions', action => 'add_date' And then: link_to "Add", add_date_to_action_url(@action.id, Date.today.to_s) -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatal

Re: [Rails] Enabling debugger in initializers

2010-02-13 Thread Rick DeNatale
n. but you should be able to do something like rdebug script/server which will give you control in the debugger at the beginning. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale Lin

Re: [Rails] no such file to load -- linguistics.rb

2010-02-12 Thread Rick DeNatale
'require "rubygems";p require "linguistics.rb"' -e:1:in `require': no such file to load -- linguistics.rb (LoadError) from -e:1 $ruby -rubygems -e'p require "linguistics.rb"' true $ruby -e'require "rubygems";p

Re: [Rails] What is the appserver for production that works best with Rails3?

2010-02-11 Thread Rick DeNatale
n these > days? Does thin plays nicely with Rails3? What is your latest > experience on this? > > Thank you very much for the insights. For production I'd use Passenger (a.k.a. modrails) with Ruby 1.9. Should work fine with Rails3 since it drives the rack inte

Re: Re: [Rails] undefined method join

2010-02-11 Thread Rick DeNatale
ust the exception message, maybe somebody will have a better chance to help. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale --

Re: [Rails] Session based Routing

2010-02-11 Thread Rick DeNatale
e session, and/or a token, and or via basic http authentication depending on the requirements of the application, and redirects to the login url if not. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/pers

Re: [Rails] Re: plural table names?

2010-02-11 Thread Rick DeNatale
On Thu, Feb 11, 2010 at 9:47 AM, Jeff wrote: > Definitely ignore as many conventions as you can, and thereby make > development as hard as possible on yourself. > Ah yes, Consternation over Convention! -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://tw

Re: [Rails] Re: some success at last, and some questions

2010-02-09 Thread Rick DeNatale
path], ['Contact Us', contact_us_path ] ].map {|tab_name, target | tab_link(tab_name, target)}.join("\n") In the view: <%= navigation_bar %> Again this is probably not exactly the code I'd come up with, but it's close to what you started with and adhe

Re: [Rails] RoR physical development environment advice

2010-02-07 Thread Rick DeNatale
A lot of water has flowed under the Rails "Bridge" since then, it's probably a wise course to look for more up-to-date tutorials, one good place to start would be http://guides.rubyonrails.org/ But make sure you are following the "current release version"

Re: [Rails] Design Pattern

2010-02-03 Thread Rick DeNatale
the to_date in the expression. >> def initialize(date) >> @date = date >> end >> attr_reader :date >> end => nil >> things = [Date.today, 2.days.from_now, 5.days.ago].map {|d| Thing.new(d)} => [#, #, #] >> things.group_by {|t| t.date.to_da

Re: [Rails] Re: "Getting Started" needs Rails 3.0, but "gem install rails" installs Rails 2.3.8

2010-02-01 Thread Rick DeNatale
which version you've selected. Actually I lied a little bit. The only difference is that if you click the Current Release Version link the title just above says Ruby on Rails guides and when you click on Edge Version it changes to: Ruby on Rails Guides Which I guess makes it perfectly clear

Re: [Rails] Re: View Helper Scope

2010-02-01 Thread Rick DeNatale
On Mon, Feb 1, 2010 at 10:20 AM, Frederick Cheung wrote: > On Feb 1, 3:11 pm, Rick DeNatale wrote: >> No, helper methods are indeed methods.  They are defined in modules, >> and those modules are included into views by the controllers, and can >> be explicitly incl

Re: [Rails] Re: View Helper Scope

2010-02-01 Thread Rick DeNatale
er::Base#helper method (which in Rails 2.x is actually defined in the module ActionController::Helpers. It's not uncommon for a Rails app to invoke helper :all in its ApplicationController which includes all helpers in the app/helpers directory and it's subdirectories in the orde

Re: [Rails] Suggestion: Merging Rails application templates with generator functionality

2010-02-01 Thread Rick DeNatale
ent by other > means? As I understand it, Rails 3 is making generators and app templates work on the same code base. <http://caffeinedd.com/guides/331-making-generators-for-rails-3-with-thor> <http://benscofield.com/2009/09/application-templates-in-rails-3/> -- Rick DeNatale

Re: [Rails] Doint something with each field in form as it is entered

2010-01-30 Thread Rick DeNatale
y field validation you'll come up with serveral plugins for both frameworks. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -

Re: [Rails] Re: Are class variables session specific?

2010-01-30 Thread Rick DeNatale
th values which have to be seen between requests is to either put them in some persistent storage on the server (e.g. the DB, SQL or noSQL), or in the session and let the browser give it back to you. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/R

Re: [Rails] belongs_to (polymorphic) or has_many (through)

2010-01-19 Thread Rick DeNatale
ower > in /loans/new ??? ### Idea 3 ### Loan belongs_to :lender, :class_name => "User" belongs_to :borrower, :class_name => "User" User has_many :lendings, :class_name => "Loan", :foreign_key => :lender_id has_many :borrowings, :class_name =&

Re: [Rails] git clone locally

2010-01-19 Thread Rick DeNatale
uch. There IS a git users group on google groups: http://groups.google.com/group/git-users -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/

Re: [Rails] Loading Model in Yaml

2010-01-18 Thread Rick DeNatale
gt; > In Unix: > rake aborted! > no such file to load -- Decode Case sensivity in the file name? Most operating systems, unlike WIndows treat file names, "Decode.rb" and "decode.rb" as different. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: ht

Re: [Rails] Re: User a owns resource x; don't let user b see user a's resources...

2010-01-13 Thread Rick DeNatale
ich scopes the find to the user's friends. Similar comment for other actions like edit and update -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.co

Re: [Rails] Using find - beginner's advice

2010-01-13 Thread Rick DeNatale
Owner belongs_to :widget Widget has_one :owner with the concommittant db table changes. Then @owners = Owner.all(:conditions => 'widget_id IS NULL') would work. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.wor

Re: [Rails] Re: Remove a restful action from map.resources

2010-01-10 Thread Rick DeNatale
t; Posted viahttp://www.ruby-forum.com/. > > As far as you know you can't. Sure you can: map.resources :users, :except => [:delete, :update] there's also an :only option -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: htt

Re: [Rails] Re: fields_for

2010-01-09 Thread Rick DeNatale
mission_fields.check_box :admin %> <% end %> <% end %> So just like form_for doesn't do any iteration, neither does fields_for. Since you haven't told us any more about what you want to do, I don't know how to help any further. -- Rick DeNatale Blog: htt

  1   2   3   >