Hi folks, I didn''t see an obvious way to fix this myself so I''m posting here. The page http://ap.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html seems to have an error in the first checkbox example where it says: check_box("post", "validated") I think it should be: check_box( "post", "validated?" ) In my own tests the ? is required if the method has it. Regards, Matt -- Matt Mower :: http://matt.blogs.it/
http://rails.rubyonrails.com/ is the official source of documentation now, and it appears fine. While it''s true that the method validated? is what you''d call in the model, validated= is still the name of the method to call for setting that attribute and therefore it''s what you use for the input name. On Wed, 9 Feb 2005 22:55:54 +0000, Matt Mower <matt.mower-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi folks, > > I didn''t see an obvious way to fix this myself so I''m posting here. > The page http://ap.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html > seems to have an error in the first checkbox example where it says: > > check_box("post", "validated") > > I think it should be: > > check_box( "post", "validated?" ) > > In my own tests the ? is required if the method has it. > > Regards, > > Matt > -- > Matt Mower :: http://matt.blogs.it/ > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Cheers Koz
On Thu, 10 Feb 2005 12:04:39 +1300, Michael Koziarski <koziarski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote:> http://rails.rubyonrails.com/ is the official source of documentation > now, and it appears fine. >Um, okay. It appears to be exactly the same text to me.> While it''s true that the method validated? is what you''d call in the > model, validated= is still the name of the method to call for setting > that attribute and therefore it''s what you use for the input name. >I don''t follow your point about validated=. The example doesn''t use that method either. In the example it indicates that for an object @post with a method validated? you would use check_box "post", "validated" In my case I have an object @feed with a method enabled? However if I use: check_box "feed" "enabled" I get an error: Showing /feeds/status.rhtml where line #17 raised undefined method `enabled'' for #<Feed:0x31a21b0> Whereas if I use check_box "feed" "enabled?" it works as expected. Maybe you can explain again what you mean? Thanks, Matt -- Matt Mower :: http://matt.blogs.it/
api.rubyonrails.org is VERY OUTDATED. Use rails.rubyonrails.com instead. Also, the second argument needs to be the name of an attribute on the model that it corresponds to. This is important because it uses the method to get the default value and it''s the name of the attribute when it comes back from the form in the @params hash. So if you reference ''method'' you need to have method and method= on your model. This is the typical usage. I usually do boolean fields with a TINYINT(1) in the database and the following change to the model. alias :validated? :validated def validated read_attribute(''validated'') == 1 end That way for the form I can say ''validated'' and everything''s happy and for code where I want to treat it like a predicate, I can call validated? In practice this has worked great for several boolean fields across my app. In short, I don''t think there''s a documentation error, and you should switch to the new docs asap. Brian On Wed, 9 Feb 2005 22:55:54 +0000, Matt Mower <matt.mower-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi folks, > > I didn''t see an obvious way to fix this myself so I''m posting here. > The page http://ap.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html > seems to have an error in the first checkbox example where it says: > > check_box("post", "validated") > > I think it should be: > > check_box( "post", "validated?" ) > > In my own tests the ? is required if the method has it. > > Regards, > > Matt > -- > Matt Mower :: http://matt.blogs.it/ > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- The years ahead pick up their dark bags. They move closer. There''s a slight rise in the silence then nothing. -- (If you''re receiving this in response to mail sent to bluczkie-OM76b2Iv3yLQjUSlxSEPGw@public.gmane.org, don''t be concerned This is my new address, but mail will be forwarded here indefinitely)
> Um, okay. It appears to be exactly the same text to me.Yeah, it is. my bad, but ....> > While it''s true that the method validated? is what you''d call in the > > model, validated= is still the name of the method to call for setting > > that attribute and therefore it''s what you use for the input name. > > > > I don''t follow your point about validated=. The example doesn''t use > that method either. > > In the example it indicates that for an object @post with a method > validated? you would use > > check_box "post", "validated" > > In my case I have an object @feed with a method enabled? However if I use: >> check_box "feed" "enabled"> > I get an error: > > Showing /feeds/status.rhtml where line #17 raised undefined method > `enabled'' for #<Feed:0x31a21b0> > > Whereas if I use > > check_box "feed" "enabled?" > > it works as expected. > > Maybe you can explain again what you mean?Is this method enabled? an active record property? If not then this doesn''t apply. If it is, then in addition to your enabled? method you get two others: * feed.enabled -> returns 0 or 1 * feed.enabled= -> sets the number returned above The helpers are about reading *and* setting your attributes and the checkbox helper uses enabled and enabled= for these purposes. Using the example from the docs, when the form gets generated it will have something like this: <input type="checkbox" name="feed[enabled]" /> Your action will do something like def update_or_whatever @feed = Feed.find(some_id) @feed.attributes= @params["feed"] @feed.save end the method attributes= will then call @feed.enabled= with either 1 or 0 based on whether the checkbox was ticked or not. Is this slightly clearer?> Thanks, > > Matt > > -- > Matt Mower :: http://matt.blogs.it/ >-- Cheers Koz
Brian L. wrote:> api.rubyonrails.org is VERY OUTDATED. Use rails.rubyonrails.com instead.If I go to www.rubyonrails.com and click the Documentation link at the top of the page, that takes me to documentation.rubyonrails.com. Clicking on any of the "Reference APIs" links takes me to api.rubyonrails.com. Are those links pointing to outdated documentation? Jim -- Jim Menard, jimm-Xhj3G7Rj6JI@public.gmane.org, http://www.io.com/~jimm
On 10.2.2005, at 15:32, Jim Menard wrote:> Brian L. wrote: >> api.rubyonrails.org is VERY OUTDATED. Use rails.rubyonrails.com >> instead. > > If I go to www.rubyonrails.com and click the Documentation link at the > top of the page, that takes me to documentation.rubyonrails.com. > Clicking on any of the "Reference APIs" links takes me to > api.rubyonrails.com. Are those links pointing to outdated > documentation?No. api.rubyonrails.com and rails.rubyonrails.com are essentially the same, the only difference is that api.ror.com has the general ror.com navigation bar at the top of the window, but rails.ror.com doesn''t. Therefore it''s imho more comfortable to use the latter as a reference (better signal-to-noise ratio ;-) The outdated docs were api.rubyonrails.ORG. //jarkko -- Jarkko Laine http://jlaine.net http://odesign.fi _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 10 Feb 2005, at 14:15, Jarkko Laine wrote:> No. api.rubyonrails.com and rails.rubyonrails.com are essentially the > same, the only difference is that api.ror.com has the general ror.com > navigation bar at the top of the window, but rails.ror.com doesn''t. > Therefore it''s imho more comfortable to use the latter as a reference > (better signal-to-noise ratio ;-) > > The outdated docs were api.rubyonrails.ORG.Am I the only one who thinks this situation is ridiculous and unacceptably confusing to the general RoR nuby? Any chance of getting api.rubyonrails.org just redirecting to the .com ? -- Paul Robinson
With the current implementation, every public method of a controller is a valid action name, which means that they are all callable via factoring a corresponding url. So every rails application is open to script kiddies. I think this is a major problem. I think it would be preferable to specify the valid actions using a class method in the controller declaration, e.g. like this: actions :index, :show, :edit:, ... I know this would break a lot of apps, but IMHO, the current state of affairs is not acceptable. To give you an idea what can be called via url, I have listed the public methods availble for tinkering: ======================================================================requestto_yaml_type instance_variables call_consider_all_requests_local fragment_cache_storefrozen? process __send__ to_a page_cache_directory action_name call_logger perform_action_without_benchmark call_ignore_missing_templates cache_erb_fragment page_cache_directoryclass call_perform_caching to_yaml_properties instance_variable_get expire_action controller_class_name cache_name_for expire_page render to_s perform_action_with_benchmark view_controller_internals send url_for clone nil? view_controller_internalsdisplay expire_fragment instance_variable_set controller_name inspect expire_actions instance_eval render_without_benchmark expire_matched_fragments perform_action_without_rescue dup remove_subclasses_of to_yaml equal? call_template_root active_layout methods require cache_page render_with_benchmark consider_all_requests_local method taint subclasses_of consider_all_requests_localeql? index hash call_fragment_cache_store showm params singleton_methods ignore_missing_templates paramsrender_with_layout extend instance_of? ignore_missing_templatesis_complex_yaml? perform_action_with_filters read_fragment id template_class session protected_methods tainted? response template_classkind_of? untaint sessionprocess_cgi responsebefore_action write_fragment call_template_class __id__ rendered_action_cache private_methods call_view_controller_internals =headers ==rendered_action_cachemodule_name freeze is_a? perform_caching logger headersrequire_gem after_action paginate object_id perform_cachingloggercookies call_page_cache_directory public_methods =~ assigns template_root request assignsrespond_to? fragment_cache_store template_roottype =========================================================================== Comments would be welcome. -- stefan
Hi all, I''ve found a small error on http://manuals.rubyonrails.com/read/chapter/28 : # examples def test_basic # hit the welcome page get ''welcome'' # make sure it was a success assert_success # make sure we were rendered by the welcome.rhtml template assert_rendered_file ''welcome'' end The correct is assert_rendered_file ''welcome.rhtml'' ## w/ extension regards, -- juraci krohling costa http://jkcosta.info
Juraci Krohling Costa <partenon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve found a small error on http://manuals.rubyonrails.com/read/chapter/28 :[...] Speaking of the docs, what''s the best way to contribute? I''ve noticed several minor errors (spelling), plus some areas that could do with some more "meat" or an example, one example being collection_select, which many are having trouble with, myself included when I first needed to use it. A simple example would probably help a lot. Should such observations be sent to the list or is there some other mechanism? -- Regards, Stian Grytøyr
> http://manuals.rubyonrails.com/account/signup/5And if it''s an addition/fix to the API docs you can submit a diff at dev.rubyonrails.com
You could apply to be a documentation author at: http://manuals.rubyonrails.com/account/signup/5 I think that''ll give you write access to the documents. Ben Stian Grytøyr wrote:>Juraci Krohling Costa <partenon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > >>I''ve found a small error on http://manuals.rubyonrails.com/read/chapter/28 : >> >> >[...] > >Speaking of the docs, what''s the best way to contribute? I''ve noticed >several minor errors (spelling), plus some areas that could do with >some more "meat" or an example, one example being collection_select, >which many are having trouble with, myself included when I first needed >to use it. A simple example would probably help a lot. > >Should such observations be sent to the list or is there some other >mechanism? > > >