Displaying 20 results from an estimated 1000 matches similar to: "Weird assignment problem, very confused :("
2005 Apr 24
2
Model names in controllers
Please excuse yet another newbie question...
I''m getting this error:
MissingSourceFile in <controller not set>#<action not set>
c:/program files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/dependencies.rb:75:in `require_dependencies'': Missing model MyModel.rb
From these lines of code:
class MyModelController < ApplicationController
2012 Oct 01
1
active_model_serializers, more than one level deep of associations, specifying serializers per association
I am assuming this an appropriate place to discuss this, but if it isn''t my
apologies- just let me know. Just a Rails 4-ish thing.
Am attempting to pull AMS (active_model_serializers), strong_parameters,
and the "permitter" strategy that Adam Hawkins is using:
http://broadcastingadam.com/2012/07/parameter_authorization_in_rails_apis/
Code so far is here (in the
2007 May 22
2
find :all :include broken on Oracle 10
Hi,
I am trying the following in Ruby using InstantRails 1.7 on WindowsXP
Publication.find(:all, :include => [:doc_type, :release_state] )
but I get the error:
OCIError: ORA-00904: "DOC_TYPES"."PUBLICATION_ID": invalid identifier:
SELECT publications.id AS t0_r0, publications.docid AS t0_r1,
publications.doc_type_id AS t0_r2, publications.title AS t0_r3,
2008 Feb 07
1
ActiveRecord 'find_or_initialize_by' dynamic finder bug? Ignoring conditions.
Hello all,
I just ran into something that I think is a bug, and I would like to
confirm with the core team whether this is expected/desired behavior
or if this is a bug that I should file and develop failing tests for
(I doubt I have the active record method_missing fu to actually patch
it).
Test Scenario:
I would like to find or initialize a new user and base the find on the
users email
2012 Mar 22
1
why doesn't .where() honor polymorphism?
I love the query interface (ActiveMethod::QueryMethods), but one thing
has bugged me: why doesn''t it generate calls for polymorphic
associations? For example:
class MyModel < ActiveRecord::Base
belongs_to :parent, :polymorphic => true
end
I would expect:
MyModel.where(:parent => a)
to be equivalent to:
MyModel.where("my_models.parent_id = ? AND
2008 Mar 05
2
Testing that a model helper method is called
So, I have a plugin that adds a method to ActiveRecord::Base, let''s call the
method is_encrypted.
class MyModel < ActiveRecord::Base
is_encrypted
end
So, my question is, how do I write a spec to show that is_encrypted is
called here? I would rather not write specs that say that the behavior is
there, since I have tested the behavior already in my plugin.
Thanks.
-Corey
--
2007 May 21
7
How do I stop a column being updated by model.save?
One of my models has a column that is updated very frequently from a
separate process, so it is important that when a record is saved in
rails, this column should be left alone. In the update method of the
controller I have:
@record = MyModel.find(params[:id])
@record.update_attributes(params[:my_model])
params[:my_model] doesn''t have a reference to the column I''m talking
2008 Feb 13
4
Migration Issues: Can't update newly added column values
Hello everyone, just wondering if anyone can help me with a migrations
question here.
Using:
rails 2.0.2
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin]
mysql 5.0.45
Platform:
windows xp
The problem:
----------
I created a migration that is designed to add a column named
"deleted_at" (timestamp) and then remove a column named
"is_deleted" (boolean). The idea is to
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 Feb 21
7
looping through a list
what is the proper way to loop through a list in a rails view (assuming
that you need to check if it is empty or not)
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2006 Apr 14
5
state_models plugin and file_column?
I was looking at Kyle Mawell''s extremely nifty-looking StateModels
plugin
http://www.kylemaxwell.com/articles/2006/02/06/fun-with-single-table-inheritance
and before I go down the road with it, I was wondering if anyone has
used it with file_column.
The way file_column deals with an uploaded file -- by storing it to the
filesystem in a path that employs the model name and id --
2007 Sep 18
2
Making attachment_fu polymorphic
I am working on a small model mixin called attachment_kung to make
attachment_fu polymorphic, so you no longer need a different table and
Model class for every associated attachment (Productimage, Ad_doc,
etc). All you really need is one model and table to handel all your
attachments - in some cases, anyway. I have the code working, but have
run into one small hitch that I can''t seem to
2006 May 31
1
ActiveRecord: When / where to validate data? Tricky question
First of all, thanks for you time. I have kind of a tricky question and
wanted to see what you guys thought.
-------------------------------------------
Lets say I have this:
-------------------------------------------
class Purchase < ActiveRecord::Base
validates_numericality_of :some_number, :only_integer => true
end
-------------------------------------------
Then I do this:
2006 Aug 09
1
How to Disable Callbacks on a Model
Does anyone know how to disable a model''s callbacks?
I have a routine that increments a page_view counter for various model
objects in an after_filter in my ApplicationController. I call this:
increment_page_view()
Rather that checking through the trace array in each model callback for
"increment_page_view" I''d rather disable the callbacks from inside
2009 Aug 10
12
v2.0 configuration parsing
I'm trying to figure out how exactly v2.0 should be parsing
configuration files. The most annoying part is if it should always just
"use whatever comes first in config" or try some kind of a "use most
specific rule". The "most specific" kind of makes more sense initially,
but then you start wondering how to handle e.g.:
1) User logs in to imap from 192.168.0.1.
2011 Apr 18
3
ActiveSupport 3.0.6: require 'active_support/core_ext' generates "circular require" warning
Hello,
i noticed some strange warnings when doing
require ''active_support/core_ext''
with activesupport 3.0.6.
If i do
gem ''activesupport'', ''=3.0.5''
require ''active_support/core_ext''
then it works fine.
Is this a bug in rails 3.0.6?
More precisely, if i do
$ irb -w
> require
2009 Aug 21
2
Requesting a remote ip in plugin
Im creating plugin for limiting the ip, i have included the plugin
name in my controller
Controller:
class AdminController < ApplicationController
acts_as_ratelimit
def login
session[:user_id] = nil
if request.post?
user = User.authenticate(params[:name], params[:password])
if user
session[:user_id] = user.id
redirect_to(:controller=>"products", :action =>
2011 Nov 30
4
How to use a local copy of rails in a rails application
Sorry for a primitive question, but how can i use a local copy of rails
with my rails 3 application (locally)?
Quick googling didn''t help, and on StackOverflow there is something
about putting local rails to the "vendor" directory, but it does not
seem to work for me.
Thanks.
Alexey.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are
2008 Jul 25
21
Problems with mock assigned to a constant
Hi all,
Initially I thought this was a bug in the built-in mocking framework(and it
still may be), but I better hash it out on the mailing list before I
file/reopen the ticket:
http://rspec.lighthouseapp.com/projects/5645/tickets/478-mocks-on-constants#ticket-478-6
I thought my example illustrated my problem, but obviously I was passing the
wrong arguments to the mock. I revised my example to
2009 Feb 09
3
can't call request.remote_ip from object?
class User
def update_metadata
self.update_attributes({:last_login_at => Time.now,
:last_known_up => request.remote_ip,
:last_known_user_agent =>
request.user_agent})
end
This does not work. It bombs out with:
undefined local variable or method `request'' for #<User:0x1e146e0>
But the request calls work in a