similar to: Helpers for models ?

Displaying 20 results from an estimated 100000 matches similar to: "Helpers for models ?"

2006 Jan 05
2
how to use a helper which is not inside app/helpers/
Hi, I wish to know it is possible to use a helper which is not inside the folder ''app/helpers'', if it is possbile, what should I do? Thanks you very much!!!! Saiho __________________________________________ Yahoo! DSL ? Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com
2006 Jul 19
3
Component Question
It appears that in Rails''s initializer.rb, the $LOAD_PATH is initialized with the paths for all the components included in the app before the models. This has the effect that if there is Foo class in your models directory and a Foo class in a component you''ve included, the Rails loader loads the component and not the model from your models directory. While you could
2006 May 30
1
Apache can''t load/require rubygems
Hi, I have rubygems installed in my home directory as I''d like to have control over gems without requiring root access. I''m trying to deploy a known working rails app on this machine but it falls down at the "require ''rubygems''" line in boot.rb. I have added the path to rubygems to LOAD_PATH in environment.rb; this is confirmed by dumping $: to a
2006 Jan 26
1
"Helper" function for my models
I''d like to create a validation function that I can use in all of my models. What''s the best way to create a method that will be available to all of my models? It looks like Helper methods only work in Views and methods in the Application class only work in controllers, so how do I make one for models? I hope this question isn''t too lame, it seems like something I
2008 Jan 29
4
Setting up release-1.0.1
Hello, I am unable to get the backgroundrb server to run. Initially I got: /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:263:in `load_missing_constant'': uninitialized constant BackgrounDRb::MasterProxy (NameError) from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:453:in
2006 Jun 01
3
Requiring /lib files in a cross-platform way.
Hi. When you have library foo.rb in your Rails project /lib directory, I notice that on some platforms - e.g. Windows with WEBrick as a server - you can require it by simply: require ''lib/foo'' However on other platforms - e.g. Debian with Lighttpd server via FastCGI - this does not work, and you need to specify RAILS_ROOT explicitly, like this: require
2006 Aug 10
5
Major security vulnerability in the latest Rails 1.1.5
Hi, I think there is still a major vulnerability exists in the latest Rails 1.1.5. The problem is in the routing.rb file and safe_load_paths method. Because of the erroneous regexp it is possible to perform a DOS attack on any rails application. To reproduce: 1. start your application 2. use this url: http://localhost:3000/debug Routing module will load standard debug.rb script which stops a
2013 Feb 03
4
Create a helper for models and views?
Hi! If I have a method that is useful in both models and in views, where would be the appropriate place to put it? The method in question just takes two dates as strings, tries to parse them and returns all dates in the range between them. It also takes care of the issues when the dates are badly formatted etc etc.. This method is being used in several models (so a simple class method in
2008 Jan 15
6
Rails plugins that use other plugins - why is does this seem impossible?
OK, probably the most frustrated I''ve ever been with Rails. If I don''t figure this out, I''m going to, um... try again tomorrow. I''m simply trying to create a plugin. I did the ./script/generate plugin MY_NEW_PLUGIN and wha-hoo great! Well, not really... This plugin uses other plugins. For example, acts_as_list, acts_as_money etc.. How the heck to I get these
2004 Mar 14
3
Re: RubyGems 0.2.0
Hello Chad, I installed and tried out rubygems for one of the win32-utils projects named win32-mmap. This is on Win XP (Home). Here is how I did it but got some errors (see at the end). I must be doing something wrong. Please help ... -- Shashank #------------------------------------------------------------ require ''rubygems'' spec = Gem::Specification.new do |s|
2006 Aug 10
4
1.1.5 Upgrade and config.load_path not working
Hey, I am trying to upgrade to 1.1.5 and rails no longer finds my controllers the live outside app/controllers. I was on 1.1.2 previously and here is my setup In environment.rb config.load_paths += [File.join(File.expand_path(RAILS_ROOT), "rails_shared/controllers") ] config.load_paths += [File.join(File.expand_path(RAILS_ROOT), "rails_shared/helpers") ]
2008 May 30
1
Adding vendor folder to $load_path
I''m using backgroundrb in a rails project, with packet and chronic unpacked in the vendor folder, to make backgroundrb I''ve added the following line to scribts/backgroundrb $LOAD_PATH << File.join(RAILS_HOME, "vendor") Do you believe it''s a good idea? I don''t like depend on the installed gems ciao ciao paolo -------------- next part
2011 Feb 21
2
self.prepend_view_path - am I missing something
I have an app that varies its content based upon the domain from which it is being accessed. Some of the domain characteristics are supported in the model but it is easier varying static text in the views and then sharing the form templates via partials etc. Rails 2.3.10 and looking at the documentation at
2006 Mar 28
5
combining two models in one controller/view "set"
I''m going to take another stab at this question (my first one received no replies): I have two models: Author has_many: books Book has_one: author I have two tables: authors id ... books id author_id ... I let the scaffolding fly and it created the CRUD goodness for each model, as expected. However, I want to have only one view/controller "set" for both models; when I
2009 May 12
2
rails 2.3.2 is not generating environment.rb properly
problem: rails 2.3.2 is not generating config.action_controller.session_store = :active_record_store in environment.rb this is the code in environment.rb --------------------------------------------------------------------------- # Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION =
2005 Dec 01
1
service_cli.rb
Hi, I just got done using win32/service to run a very small/hack-ish "Riki" WEBrick service. Very cool stuff. Thanks. So, in the process, I noticed a lot of the "control" start/install/etc. command line parser stuff looked a bit boilerplate, so I pulled it out into a helper function "service_cli" (for lack of a better name). Its simple, but it allows me to do away
2006 Mar 17
2
Controller/View Organization (Newbie Question)
Good afternoon all... First, let me apologize for asking a potentially dumb question. I''m new to both Ruby and Rails, but I do have a long background in OO programming and web development. My question is about how to structure controllers for the various models which I will need in my application. My data will look something like this: Dog - (has_many) TrainingSessions -
2008 Dec 01
2
strange rails error on ubuntu 8.10
Just upgraded from 8.04 to 8.10, which bumped my Ruby version to 1.8.7, and my Rails app (frozen to 2.2.2) gets a strange error on startup. I can easily reproduce just by running script/about: $ script/about /vendor/rails/actionpack/lib/action_view/template_handler.rb:11:in `initialize'': wrong number of arguments (0 for 1) (ArgumentError) Anyone else having trouble with Rails on Ubuntu
2006 Feb 14
22
Teaching Models to Render Themselves in the Controller
I am trying to teach my models how to render themselves, i.e. <%= my_model_object.render() %> Let me explain my reasoning and proposed method before this gets shot down as anti-MVC. Let''s say I am writing a contact-management application. I have a class Contact. I will need to display this class all over the application. My first choice is to use a partial. Now I can
2006 Feb 21
4
Models, Helpers, Modules, etc.
Hello, I am learning rails and ruby and I have some questions about how should I go about doing certain things. [1]Many of my models have some functionality which is common, and instead of duplicating it across models, I want to store it in a single file, and then import the file into the models. Should I do this using modules, and then store them in the `lib'' directory? What is the