Displaying 20 results from an estimated 2000 matches similar to: "deprecation warnings"
2010 Apr 13
5
params[hash] and link_to.... easy question... but I am stupid :)
routes.rb
map.connect '':controller/:action/:id/:draw_id'', :controller =>
"admin", :action => "edit_position"
In a view I have:
<%= link_to "#{@draw.positions[0].team}", { :controller
=> :admin, :action => :edit_position,
:id
=>@draw.positions[0].id, :draw_id =>
2008 May 28
2
functional testing joins table problem
I have models/controllers
Class Facility
has_many :facilities_services, :dependent => :delete_all
Class Service
has_many :facilities_services, :dependent => :delete_all
Class FacilitiesServices
belongs_to :facility
belongs_to :service
so in my test/functional/facilities_controller_test.rb, I have
post :destroy, :id => 5
which tosses an error...
2008 Apr 02
9
Problem getting the most recent has_many associated object
I can''t get my view to display the most recent parameters from an
associated object in a view... here is a birds-eye of my app:
I have two models, Ferms and Kinetics. Ferm has_many :kinetics,
Kinetic belongs_to :ferm. Kinetic has the fields ferm_id, brix and
temp.
In my ferms/index view I have a table listing the attributes of each
ferm instance. I would like to display the most recent
2009 Jan 01
2
Ruby on rails API website suggestion
I would like to request a feature.. like: http://rubyonrails.org/function
and it
will search inside http://api.rubyonrails.org for the function and
show it.
Like PHP has.. http://php.net/basename
Example: http://rubyonrails.org/truncate and it will points to
http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M001541
That woul be cool.
Thanks
2009 Jan 01
2
Ruby on rails API website suggestion
I would like to request a feature.. like: http://rubyonrails.org/function
and it
will search inside http://api.rubyonrails.org for the function and
show it.
Like PHP has.. http://php.net/basename
Example: http://rubyonrails.org/truncate and it will points to
http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M001541
That woul be cool.
Thanks
2009 May 13
2
Object and Classes ?
I found a tutorial for creating classes using generic functions ? S3
way ! It was short description so I couldn't grok in full its
usage ... So far so good, what i currently do is something like this :
Blah <- function(data,...) UseMethod('Blah')
Blah.default <- function( ...... ) {
self = ....
class(self) <- 'Blah'
self
}
Blah.some_method <-
2006 Feb 15
2
extending rails via /lib - problems
I wanted to group some functions which I use in some models in one
place. Controllers have application.rb and views have helpers but I
couldn''t find anything about models. Using the /lib directory seemed to
be the only way.
Alright... so I have something like this:
/lib/code.rb
class ActiveRecord::Base
def method_a(n)
.......
end
def method_b(n)
........
end
end
2007 Mar 09
3
Password protecting access to script/console ?
Sorry if this is asked and answered before, is there away to password
protected access to script/console ?
I''ve seen a few posts on how to protect/encrypt the db passwords in
database.yml, but that still leaves unprotected access to pretty much
the same data via the console.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received
2008 Sep 27
3
make a system call and proceed without waiting for result?
This is probably a general ruby question: in one of my models i need to
make loads (up to 600 or so) of system calls with the curl command.
It''s a fire-and-forget kind of deal - i don''t care, at that particular
moment, whether the calls were successful or not and i certainly don''t
want to keep the user waiting for the html responses to come back.
Is it possible, with a
2006 Jul 12
1
When to use Mutex::synchronize?
I have a simple question when to the synchronize method in the Mutex
class.
Now that backgroundrb has allow_concurrency = true there is no need
to synchronize database calls in threads.
The question I have is lets say I have a simple method in my worker
as follows:
def some_method
SomeModel.find_all each do |obj|
obj.some_count += 1
obj.save!
end
end
It accesses the database, but
2006 Feb 18
5
Model methods and partial view templates
I have a method in a controller that invokes a
render :partial => ''some_partial_view''
In that view, I''m trying to access a method defined in a model, like
this;
<% for view in @an_array %>
<% local_var = view.some_method() %>
<% another_var = view.a_column_name %>
etc..
I am getting an undefined method error but the model is accessible
2006 Feb 16
10
Ruby class variables and access from view templates
I have an app that requires me to define a class variable (actually an
array) in a controller and then access it from within a view. It seems
that the class variables aren''t working right. Here is an example of
what I''m trying to do.
class DisplayController < ApplicationController
@@thumbnail_array = Array.new
...
def some_method
@@thumbnail_array = SomeModel.find_all
2011 Dec 17
39
Stack Level Too Deep Error (can't seem to figure it out)
Hi all,
I am running into a weird issue where my application is giving me a
stack level too deep error. I can''t seem to find where my code is
throwing this error. On the machine I developed this code on, this
error does not show up when I run rails s but when I move the code to
another system to run it this error shows up.
The system that this code runs fine on is a mac os x machine
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 --
2008 Jan 27
2
conditional validation
Hi,
How can I validate user info under certain conditions? For example, I
just downloaded a plug-in that allows me to validate phone numbers,
but what I would like is to only validate the phone number if it is
not blank and if the user_type_id field is equal to one.
How can I achieve such a validation in my user model?
Thanks, - Dave
--~--~---------~--~----~------------~-------~--~----~
You
2006 Nov 02
4
application controller security
Shouldn''t everything in the application controller be protected by
default?
I just realized that my app can be called like this:
www.myapp.com/application/method and it actually tries to run that
method inside my application controller.
Is everyone else just adding "protected" at the top?
Thanks,
Chad
--~--~---------~--~----~------------~-------~--~----~
You received this
2009 Apr 21
2
validates_uniqueness_of
hello all,
i am new to RoR programming and am struck with the functional test whole
checking for uniqeness of carriers. If it is not unique,the the bin
shudn''t be created.Can someone help me in correcting my code.
def test_create_failure_cycle_unique
begin
num_bins = Bin.count
post :create, {:bin => { :carrier => carriers(:A), :cycle =>
cycles(:one), :name =>
2010 Sep 16
3
Resyful authenticatio current_user in model
Hi,
I am using Restful authentication for user authentication.
I want the current logged in user object in my model property.rb
Problem is current_user is not working on model.
How can I fix this I need that?
Please help me out.
Thanks,
Mike
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"
2007 Jun 18
2
weakness of helper?
Hi ,
It comes to me that helper has some weaknesses:
1) It is hard to test . No easy way to write test code for it.
(or Just i didn''t know?)
2) Not easy to reuse it on other controller/view/model.
it looks like to that putting the helper code into a model (a
fully helper model , or a mixed model) is good practice.
However i agree that some html intensive
2012 Sep 04
5
Associations and Math between Models
I''ve setup two models, 1 and 2, that are associated by
has_and_belongs_to_many. I''m trying to get an attribute from model_1 to use
in a method in model_2. When I use the code below, I get an error saying
''undefined method model_1_id''. What am I missing? Thanks!
Model_2.rb
Class Model_2 < ActiveRecord::Base
...
has_and_belongs_to_many :model_1
def