similar to: understanding rails internal architecture

Displaying 20 results from an estimated 4000 matches similar to: "understanding rails internal architecture"

2006 Jun 07
1
validates_presence_of in a mixed-in module?
Anyone got any idea of how to use built-in validation methods in a mixed-in module. What I''ve got at the moment is each class that needs ranking methods includes [the module] Ranking. Then the module Ranking has a bunch of instance methods and a submodule ClassMethods. The ClassMethods in this are mixed in to the class with self.included. So far so good. But I want the module to
2005 Dec 19
2
Validation that works in the controller
Hi, Is there a way of validating input inside the controller? or an equivalent to ActiveRecord::Validations::ClassMethods.validates_presence_of ? Cheers, -- Colin
2009 Dec 25
2
Understanding “create_association” and invalid objects
The documentation on the “create_association” method of the “belongs_to” association reads: > create_association(attributes = {}) > Returns a new object of the associated type that has been instantiated with attributes, linked to this object through a foreign key, and that has already been saved (if it passed the validation).* My expectation from this documentation is that calling
2009 Jan 20
0
alias_method_chain in Facebooker Causing Stack Level Too Deep
I installed the Facebooker plugin and upon placing it on a staging server, I keep running into stack level too deep errors. It seems to stem from Facebooker using alias_method_chain to override some of the ActionController methods. I believe it''s getting loaded twice causing confusion. I''ve tried various methods include wrapping a unless respond_to?(:method) around the
2007 May 14
0
building and saving has_many and has_one relations
Hi, I am very confused about an aspect of has_one and has_many relations, with regard to using the build method, and saving the belongs_to side. It''s a somewhat long post. so please bear with me :) First let''s consider the has_one scenario. Let''s say I have a student who must own exactly one car: class Student has_one(:car) end class Car belongs_to(:student)
2006 Dec 26
0
alias_method_chain vs. redefined method with super
I''m trying to fully understand the subtleties of using alias_method_chain to refine method behavior versus redefining a method and calling super. I have a simple data model (a music collection) that I often use to evaluate web frameworks, and I''m trying to get it working on Rails 1.2.0RC1. Specifically, I have three classes which subclass a common Artist class: - Band
2008 Apr 09
0
Understanding ActionMailer::Base.new
While writing a small plugin I stumbled upon this strangeness. I have TMail objects stored in database for process that sends them out whenever needed. Obvious way of sending them out would be calling ActionMailer::Base.deliver(my_mail_object) That works just fine. However I have method chain hooking into instance method deliver!: alias_method_chain :deliver!, :something_crazy so I need to
2006 Jan 02
0
Extending a model in a component...
I know I''m missing something basic, but I need help understanding something: I have a model (User) sitting in a component. I want to extend that model from my app. I need to add in a has_many relationship and a couple of methods. I was able to mixin the methods using this: module MyUser def my_new_method # etc end end User.send(:include, MyUser::Acts::Chicken) This just
2009 Sep 09
0
Rails 2.3.4 ActiveRecord association problem
Upgraded our app from Rails 2.2.2 to 2.3.4, and I''m now encountering an error when adding a child to a parent. Top of the stack: wrong number of arguments (1 for 0) /Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/ associations/has_many_association.rb:61:in `save'' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/
2007 Apr 12
0
Does Ferret have problems with #alias_method_chain ?
Hi all, I have this in my class: class Party < AR::B acts_as_ferret :store_class_name => true, :remote => true, :fields => (self.content_columns.map(&:name) rescue []) + %w(main_identifier) class << self # #count is also defined, omitted for clarity def find_with_destroyed_scope(*args) with_destroyed_scope do
2006 Aug 16
0
acts_as_paranoid and alias_method_chain
when i require acts_as_paranoid I''m getting: undefined method `alias_method_chain'' for #<Class:ActiveRecord::Base> (NoMethodError) It happens in acts_as_paranoid''s init.rb. here''s the whole file. the alias_method_chain is near the bottom. please advise. class << ActiveRecord::Base def belongs_to_with_deleted(association_id, options = {})
2006 Apr 18
4
Mixin variables
I''ve created an access control module that I''m including in several different controllers. Everything works fine, but I want to allow each controller to override the default login page with something like this: set_login_pages :secure => ''my_login'' In my module, I''ve set up the set_login_pages method like this: def self.included(base)
2009 Oct 21
3
alias_method_chain and ActiveSupport::TestCase
I''m trying to add some functionality to the setup method of all my tests. I added a method called setup_with_ts in the test_helper and chained it using alias_method_chain :setup, :ts and that works great for every test that does not define setup in the test. So for my unit tests i tried also defining the same method setup_with_ts in a class ActiveSupport::TestCase def setup_with_ts
2006 Sep 05
0
Reloading dependencies in Edge Rails?
I''m developing a library called Hark. The structure is: lib/ hark/ session.rb mixins.rb hark.rb hark.rb: ==== module Hark include Hark::Mixins ... end application.rb: ==== class ApplicationController < ActionController::Base include Hark end my_controller.rb: ==== def login hs = session[:hark_session] = Hark::Session.new ... end So application.rb
2005 Dec 26
0
Why isn''t this working???
This is a very straightforward problem.. -I included a mixin in lib/ (see below) -In environment.rb, I included the require statement (require ''acts_as_tree_additions'') -Defined a method in the model: def category_list format_as_list #method in acts_as_tree_additions end -Called that method in the view.. I know the method is in the correct use, because it prints out a
2007 Mar 22
0
`alias_method_chain': undefined method `find' for class `ActiveRecord::Base' (NameError)
I can''t seem to be able to override the :find method in the model base class, for example, in /lib/usermonitor.rb: module ActiveRecord module UserMonitor def self.included(base) base.class_eval do alias_method_chain :find, :user def current_site Thread.current[:user] end end end def find_with_user(*args) ... end end
2009 Dec 27
5
Difficulties in understanding Rail-Plugins in depth
Hi, i try to understand how plugins work in detail. Often you see stuff like: class Post < ActiveRecord::Base   acts_as_commentable end I wonder what''s happen all there. What kind of language-feature is behind this call "acts_as_commentable" ? In my opinion you need some kind of extend or include to extend the functionality of a model. And exactly this is which i found
2009 Dec 29
1
undefined method `alias_method_chain' for I18n::Backend::Simple:Class
Hi, We are running RE: ruby 1.8.7 (2009-06-12 patchlevel 174) [sparc-solaris2.10], MBARI 0x8770, Ruby Enterprise Edition 2009.10 I tried a simple web app with a controller rendering a text and is working in my PC but on the server I get: Error message: undefined method `alias_method_chain'' for I18n::Backend::Simple:Class Exception class: NoMethodError Application root:
2011 Apr 08
5
How to extend a helper using plugin?
Hello, I''m facing this problem while trying to extend the parse_redmine_links helper method in Redmine-1.1.0 (Rails-2.3.5) from my plugin. My idea is to use alias_method_chain so the extended version could call the original version and adjust the result to it''s liking. Anything I''ve tried so far exposes this behavior: the first render of a page uses the extended
2011 Jun 16
0
Rails 3.1, SASS, @import, and directories
So, here''s the problem: @import isn''t liking other directories. Example: app/ assets/ stylesheets/ extras/ _mixins.sass _variables.sass photographs/ index.css.sass And the contents of app/assets/stylesheets/photographs/index.css.sass is: @import "../extras/mixins", "../extras/variables" I get the following