search for: railswheel

Displaying 20 results from an estimated 22 matches for "railswheel".

Did you mean: railswheels
2008 Oct 21
6
detecting width overflow in serialized column with mysql
So I''ve got an ActiveRecord model pointing to a MySQL db, with an auto-serialized column ("serialize :columnName"). Thing is, MySQL, depending on how it''s configured (like, by default), has a bad habit of just truncating your data if it''s too wide for the column, with no error raised. Yeah, I can probably reconfigure MySQL and/or my AR connection to it. But
2008 Dec 13
3
how to do "special queries" ala The Rails Way on "associated" conditions?
I have the following in a model class: class Game < ActiveRecord::Base has_many :player_stats has_many :players, :through => :player_stats def visitor_stats stats = [] player_stats.each do |stat| stats << stat if stat.player.team.team_code == self.visiting_team_code end stats end def home_stats stats = [] player_stats.each do |stat| stats << stat if
2008 Dec 20
4
uninitialized constant BooksController::Books
hi new to rails ... wat does it means... uninitialized constant BooksController::Books /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:102:in `const_missing'' app/controllers/books_controller.rb:5:in `index'' -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are
2009 Feb 19
3
Associated child records not created on creation of a parent.
I am trying to create a record with association. Within the create method, I would also like to pre-populate dependent (has_many) records from a template in the database. The child records are <u>mysteriously rolled back </u> if I insert them in a loop. If I try to insert a single child record, it works.I have read the books and tried to google my way out of this but am at a dead
2008 Nov 12
5
dynamic condition for has_one and eager loading issue
Hi, I ve defined the following relation in one of my models with a dynamic where condition: has_one :selection, :foreign_key => ''object_id'', :conditions => ''selection_type = 1 and account_id = # {self.send(:account_id)}'' That works perfect, however when I try to eager load that relation I am getting the following error when doing a
2008 Dec 13
3
session In the model
Hi i have the model SDTicket which has a field modified_by_id and it has to take data from session[:id] Now this SDTicket model has many associated models like Activity one of them So when ever an activity happens then also the value in session[:id] is to be go to modified_by_id field SDTicket has_many activities Activity belongs to SDTicket So for that what I am trying is in Activity
2009 Jan 23
4
getValue() in a Controller problem, help please.
Hello there, I''m trying to do something like: render :update do |page| page[:client_list].replace_html render(:partial => ''client_list'', :object => @clients_list) name = page[:name].getValue(); end but I''m not getting the value, or somehow use $("name").getValue() inside of the controller. How can I do that? tks, David Sousa --
2009 Jan 21
5
Runner suddenly fails...
I have some jobs running through cron jobs and runner that suddenly starts failing. This is how it looks: from /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/commands/runner.rb:47 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' from
2009 Jan 09
6
Accessing request.host in UserMailer
I am using subdomains in my application to control context. Therefor, during user registration, password reset, and other actions that require an email to be sent with a link to be clicked, I need to ensure that the subdomain appropriate for the user is used. It seems I need to be able to access request.host from within an ActionMailer model. But I am not clear how to do this. Any help would be
2008 Sep 15
1
url_for_file_column within if within a partial
I have a partial that has the following code: <% if product.prd_big_image.nil? %> <img alt="Image" src="/images/empty.jpg"> <% else %> <%= image_tag url_for_file_column(:product, :prd_big_image, "normal") %> <% end %> and get the following error You have a nil object when you didn''t expect it! The error occurred while
2008 Dec 16
1
Callback when objects connect as a habtm relationship
If Product and Category models are in a habtm relationship, i.e. class Product < ActiveRecord::Base has_and_belongs_to_many :categories end class Category < ActiveRecord::Base has_and_belongs_to_many :products end I want a piece of code to be executed every time a product is connected to a category. Where do I put this code? Which callback (and on which model) will be triggered? Any
2008 Dec 31
1
when to set a class attribute variable during boot
I have an ActiveRecord model with a cattr_accessor. The class attribute is set up like this: class MyModel < ActiveRecord::Base cattr_accessor :my_attribute end Because I need to give #my_attribute environment-specific values, I try to set this attribute in environments/development.rb like so: MyModel.my_attribute = 3 But this leads to odd and erratic behavior when #my_attribute is called
2009 Jan 06
2
Update_attributes on multiple models, revert back on error
Hi, I have one method, ''updateStuff'', that will call ''update_attributes'' on 3 different models in the DB..... How can I account for validation to revert back all updates if one of the models is not valid? I''ve looked into Model.valid? which doesn''t seem to work for me .. Any idea? Thanks
2009 Jan 25
1
habtm relation and dependent => :destroy
Hi all , I have a habtm relation between 2 tables: - users - rights If there a way to affect a destroy dependance on those 2 tables only for the last instance? In my opinion, dependent => :destroy is not the solution because this delete all the linked instance. For example, if I have: # in User model this: - "Joooooo" - "Jeannnn" - "Tommmm" # in Right
2009 Feb 15
3
conditions on association include, hacky but more or less solved
Hi all, I just finally figured out how to get 2.2.2 to do this, and thought I''d share in case others run into the same thing. The situation is a find with associations, but the tricky part is that the association shouldn''t always be loaded. This is similar to putting a condition on a has_many association in a model, but the condition is dynamic rather than predefined. The
2008 Dec 06
1
find with add of an atttributes
I have wrote this: EventDate.find(:all, :include => [:container,{:event => [:photo,:event_type_names]},{:place=>:location}], :joins =>" RIGHT JOIN (SELECT event_dates.id,date_add(event_dates.date, INTERVAL i DAY ) AS date FROM (select 0 as i union all select 0 union all select 1 union all select 2) as integers CROSS JOIN event_dates
2008 Oct 21
1
How to force a lock_version increment
Hi everyone, I have a order with order_lines use case. On changing the lines, I want to be sure no one else changed the order. So I use lock_version on the order. This works fine if something is changed on the order record. But now i have the situation that I delete, alter and add order lines without changing the order record itself. I have to check and increment the order#lock_version however
2008 Oct 31
10
Strange dependency error after going Ruby1.8.6, Rails 2.1.0 -> Ruby1.8.7, Rails 2.1.2
Hi, I''m getting an error I just can''t find any cause for. The error is "A copy of ApplicationHelper has been removed from the module tree but is still active!" and gets thrown in a Template that uses a method defined in my ApplicationHelper. The error occurs only in development mode. The error did not occur before my switch to Ruby 1.8.7 and Rails 2.1.2 minutes ago. I
2009 Mar 18
1
set_table_name woes, fragmented domain class
Hi all, I''m running Rails on top of a Mongrel cluster. I have several model classes that are going to have so many records it is not feasible to keep them all in the same table. So I''ve split out the records into many different tables, each with its own suffix which corresponds to the id of the model to which all records in that particular table belong. For example,
2008 Sep 02
3
Unable to set default_url_options[:host] for Action Mailer
I am attempting to provide ActionMailer with the request host needed to generate a url. Here is my code: In config/environments/development.rb config.action_mailer.default_url_options = { :host => "development_url.com" } and in config/environments/production.rb config.action_mailer.default_url_options = { :host => "production_url.com" } When I run the above code