similar to: Help with Eager Association

Displaying 20 results from an estimated 300 matches similar to: "Help with Eager Association"

2008 Sep 16
3
has_one :through eager-loading problem
I have a problem with the :include option in find for my has_one :through association. I have Users, Profiles and Customers, all connected to each other with a has_one :through => :membership association like this: class Profile < ActiveRecord::Base #could also be user or customer has_one :membership # i saw an acrticle of Ryan about has_one :through, there this would be has_many, is
2010 Aug 16
8
Executing js.erb file with :format =>'js'
Hi, I''m trying to get my javascript to execute after clicking a link on my page using :format => "js" here''s my link: <%= link_to image_tag("/images/icons/user_add.png"), add_contact_path(:profile_id => profile.id, :url => request.url, :format => "js"), :title => "Add person to your contacts"%> in my controller i have
2006 Jan 19
3
Migrating from Mysql to PostgreSQL
I tried to use ''rake db_schema_dump'' from old MySQL database and then use ''rake db_schema_import'' to rebuild the database in PostgreSQL. The issue here is that only some of tables can be imported successfully. For example, in the dumped schema.rb: create_table "profiles", :force => true do |t| t.column "ticker", :string, :limit
2005 Oct 14
1
join tables and position (acts_as_list)
I''m working on some schema for a new project that we''ll be doing in rails (our first rails project!). A recurring structure we are seeing is the desire to define an ordering any way we wish, so ''acts_as_list'' comes to the rescue. But, the ''position'' column seems to need to belong in the join table to make sense. For example, we have
2010 Feb 11
3
Parameterized ActiveRecord Associations: Any such thing?
Hi list, how are ya? So, my current project is just begging for the ability to have parameterized associations in my ActiveRecord classes. Basically I need something that is a cross between named scopes and standard associations (has_many specifically). I''m wondering if such a thing exists or, if not, if anyone else has an elegant, equivalent solution? Example: class Sprocket <
2010 Aug 21
4
No route matches?
Hi all, I''m coming from the PHP world and I''m trying to learn Ruby and Rails. I''m having a problem where I keep getting the error "No route matches / home/view" even though I have it defined it. I''d appreciate any help on this. I''m using rails 3.0 and the setting for the environment is "development". # routes.rb
2006 May 11
1
RoR completely ignoring a column when saving changes
I have an action that needs to update two models/two tables in one shot, and it works great, but ignores one column. Here is the action code: (verify_id is irrelevant in this case) [CODE] def edit @page_title = "Edit User" @page_active_3 = "active" if request.post? @user = User.find(params[:id]) @profile = @user.profile verify_id(@user.id,
2008 Apr 14
2
Problems with nil object
Hi to all. I''ve a very big problem. I know this can seem very loing, but please, try to read it. I have a simply blog, with posts and their comments. I''ve two tables in my db, posts, with post id, text and comments_count to store the number of comments-children of each post (as recomanded to do in AWDWR); and the table comments, with comment id, post_id for the post
2006 May 15
0
losing validation error messages
Hello all, I am pretty new to Rails and have recently started on a simple project with it.. I have a simple home_controller and home/index.rhtml page that displays a login/registration form. The login/registration actions are handled by users_controller.rb. register action in users_controller always redirects back to :controller => "home", :action => "index".. The
2005 Dec 18
0
Caching question
I''ve got caching mostly working but it''s acting string with the index/home. On the site I have a redirect the points http://nutritionreality.com at http://nutritionreality.com/home I do this in routes.rb by: map.index '''', :controller => ''home'', :action => ''index'' Caching happens on index (index.html gets created in
2010 Jul 25
0
You can't set a constant with namespace in the initializers?
Help! in my rails controllers, there is a ''Admin'' namespace. (My the structure of the controllers dir is like this : app/controllers: home_controller.rb ... admin/posts_controller.rb admin/pages_controller.rb The ''Admin'' will automatically become a Module constant (I know it from the console: ''puts Admin => Module''); And in my
2014 Jun 04
0
Design question: Redirection to a "create" action.
My application should behave like this: - My application manages (among others) a resource called "Dicts", i.e. there is a dicts_controller, and my routes.rb contains a "resources :dicts". - I have a home page (starting page), which will eventually contain some user authentification (not implemente yet), and then allow the user to manage the Dicts objects. I have a
2006 Nov 20
0
End-of-File Error occured at <except.c>:79 in xraise
On an average I get this error twice or thrice a week. After I rebuild the index Event.rebuild_index it works fine. I''m a bit puzzled by this behavior. Why does this happen? I am using AAF. End-of-File Error occured at <except.c>:79 in xraise Error occured in store.c:216 - is_refill current pos = 301, file length = 301 /usr/local/lib/ruby/site_ruby/1.8/ferret/index.rb:517:in
2006 Jun 17
2
RJS templates - newbie
I am trying to test drive RJS templates in Rails 1.2. Here is what I did: create table categories (name varchar(255) ); rails RJSTest cd RJSTest rake update_javascripts script/generate controller home index add script/generate model category Note: When I did a rake update_javascripts, I did not see any output. I configured database.yml to talk to mysql. Next I wrote
2006 Jun 24
6
Ajax fade effect
I have a list of categories, when I delete one of them, I want that item to fade and then get removed. So I do the following: 1. home_controller: def delete @category = Category.find_by_name(params[:name]) @element_id = @category.name Category.delete_all(["name = ?", @category.name]) end 2. delete.rjs: if @element_id page.visual_effect :fade, @element_id
2009 Mar 26
1
Error Send Message
Hello, I''m trying to make my rails app send mail. so it''s can''t send it''s error. I''m using the following configuration in environment.rb: == Rails::Initializer.run do |config| ... config.action_mailer.delivery_method = :smtp end ActionMailer::Base.smtp_settings = { :address => "mail.mydomain", :port => 25, :domain =>
2005 Dec 17
13
Rookie with ActionMailer
To start out I''ll say that this is the first thing that I''ve ever built that''s been intended to programmatically send email. I''m looking at examples in AWR and also on the wiki. I feel that I sort of have things set up right but I''m getting an error I can''t grok: Net::SMTPFatalError in Home#email_list 550 5.7.1 Unable to relay for
2006 Jan 19
0
Limited eager loads and conditions on the eager tables
Hi, Why are limited eager loads and conditions on the eager tables incompatible? Doing a find(:all) without :include causes a select * query to be generated, which means the id fields everwrite each other if associated tables are included using :joins. But using :include, if conditions are placed on the tables listed in :joins then Rails throws an exception when :limit is included too.
2008 Mar 31
1
database design help
Hi, I''m coding a little application to make couples profile. The problem is I just don''t know how to create my databases so that their are no bottlenecks and that I can have a relation. The way I see it is that their would be a user database and a profile database and they would link 2 to 1. Is this the right way? In the user db I would store their userid and some session info,
2006 Aug 04
2
problem eager loading with sti
Here''s the setup (working off Rails 1.1.4): Class Project belongs_to :employee Class Employee < Person has_many :projects When I try to paginate(:employees, :include => :projects) I get the error "Association named ''projects'' was not found; perhaps you misspelled it?" I can :include other models that the Person class has_many or habtm of, and if I