similar to: sort_by with via a parent models child

Displaying 20 results from an estimated 400 matches similar to: "sort_by with via a parent models child"

2007 Sep 05
4
Mocking to spec a sort_by method
Hello, I have a question regarding the use of Mocha with rSpec to spec one of my methods. My spec contains the following vehical1 = mock() vehical2 = mock() vehical1.stubs(:mph).returns(150) vehical2.stubs(:mph).returns(250) comparer.add_vehical([@vehical1, @vehical2]) comparer.sort_by(:mph) The comparer is an object that has a basic "stack like" functionality, add_vehical is the
2006 Dec 04
10
Avoiding SQL Injection in :order?
This thread references: http://www.ruby-forum.com/topic/90258#new http://www.ruby-forum.com/topic/82349#143790 ActiveRecord''s find() method has built in ways to avoid SQL injection by using the format > :conditions => [ "user_name = ?", user_name] Is there any such system for escaping injection in :order? It seems to only take a string and feed it to the SQL
2009 Jan 16
2
regshell only goes to HKEY_CLASSES_ROOT
Hi all, I've compiled samba 4 from branches and it worked like a charm. I'm trying to use regshell to read (remotely) the following Windows registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall I can connect to the remote machine with no problems: ./regshell --remote=192.168.50.142 --user=Administrador%xxx HKEY_CLASSES_ROOT> HKEY_CLASSES_ROOT>
2009 Dec 22
3
vector indexing problem in multilevel data: assigning a specific value to all group members
Dear List, I work with multilevel data from psychological group experiments and have frequently encountered a situation for which I haven't found an elegant solution: I need to assign the value of a specific group member to all members of the group. For example, I have a group leader (identified by a binary vector) and some attribute for all group members. I want to create a new
2006 May 14
4
searching on foreing keys
Hey all, I''m using a simple search function. It''s working great except for foreign keys. I have one table pets (id,name,owner_id) and another table people(id,name) owner_id being a foreign key of pet pointing to people name. here it is on the pet controller: @paginator, @pets= paginate(:pets, :conditions =>["name OR owner_id like
2009 Jan 13
1
ROR - Excel Export Example
If you are running on Windows you can use create and read speadsheets using the ''win32ole'' require This sample should give you the basic idea ------ def export require ''win32ole'' @sort_by = ''last_name'' current_user = ''steve'' @records = Contact.find( :all, :conditions =>
2006 Aug 18
4
HELP!!!! - number_to_currency in model?
Hi, I''m trying to use number_to_currency in one of my models, but i''m getting the following error: undefined method `number_to_currency'' for #<Product:0x396d680> Obviously, my Product model can''t access number_to_currency -- is there something I need to do to make it available? Thanks so much for your assistance. -- Posted via
2006 Jan 10
1
sql server freetds/odbc question
I''m having an error from Linux via freeTDS/ODBC to SQL Server with cod that runs fine against SQLite and MySQL. Here''s the code: def find_recipes_for_workorder_by_id @recipe_pages, @recipes = paginate_with_sort :recipes, :per_page => 10, \ :conditions => ["recipe.workorder_id = ?", params [:workorder]] render :template =>
2012 Dec 13
3
how to aggregate the dataset
HI, Sorry for messing up.. I want to transform the following dataset: product min_price max_price mean_price country price_band 11 34 50 40 VN 0-300 22 10 30 15 VN 0-300 Into: product VN price_band 11 40 0-300 [34,50] 22 15
2012 Mar 28
4
Hash iteration order in a template not consistent
Hi, I did some basic googling, but didn''t find an answer yet. I am sorry if this is a FAQ. In a manifest for creating an Apache config file, I define a hash like this: $aliases = { ''/foo/'' => ''/home/foo/www/'', ''/bar/'' => ''/home/bar/www/'', ''/baz/'' =>
2008 Mar 28
6
Eager Loading + Confusion
So I''m trying to do a find with an order by specific column values thing, but some of the columns are attributes through associations. So I did some eager loading with the :include option to try and access the attributes of the object I''m doing the find on. Stuff has been blowing up on me so far. Here''s the code in the controller right now: sort_by = params[:sort_by]
2006 Jan 10
1
sql server & linux: left join problem
I''ve got a left join problem of some sort connecting from linux FreeTDS/ODBC to SQL Server. It''s similar to the false post I had earlier, but this is a real problem. Here''s my code: def find_recipes_for_workorder @recipe_pages, @recipes = paginate_with_sort :recipes, :per_page => 10, \ :joins => ''left join workorder on
2012 Sep 10
3
How to remove last comma when iterating through hash in erb template
I need to produce a line in a config file in the format x = "ip1,ip2,ip3" I am using the method below to sort the hash before iterating over it. However, as you can see there will always be a final comma which breaks the app that uses this config file. Does anyone know how I could remove the final comma? ipv4_bind_addresses = "<% routes.sort_by {|key, v| key}.each do |key,
2018 Jan 19
1
Web scraping different levels of a website
Hey Ilio, I revisited the previous code i posted to you and fixed some things. This should let you collect as many studies as you like, controlled by the num_studies arg. If you try the below url in your browser you can see that it returns a "simpler" version of the link you posted. To get to this you need to hit F12 to open Developer Tools --> go to Network tab and click on the
2006 Feb 19
2
progressive updates
I have a list view and have it sorting the data presented in the list view by clicking on the top of the column - that works fine. Now, I want to add a pop up-list which controls 3 different levels of record select to be presented in this list... - ALL - placement.discharge_date IS NULL - placement.discharge_date IS NOT NULL I can have 3 different ''methods'' and
2006 May 02
4
ordering after a inject
Hi, My results are getting out of order after I do the following command: count = result.inject({}) { |hsh, row| hsh[row[''name'']] = row[''count''].to_i; hsh } Why? Here are more specifics: My complete method is this (based off of acts_as_taggable code - not'' DHHs, but the original one): def self.sql_to_count_plays(lookback) sql =
2011 Nov 21
1
Weird R's behaviour with a quoted name
Can someone explain why the following happens? --- :> quote(some.name) some.name :> bar <- structure(quote(some.name), class = "foo") :> quote(some.name) Error in print(some.name) : object 'some.name' not found :> bar <- quote(some.name) :> quote(some.name) Error in print(some.name) : object 'some.name' not found :> bar <-
2011 Nov 30
1
glm step() fkt
Hi volks, i have a question about the step() fkt. Is there a possibility to save the last model generated from this method. I have a loop and so i generate 100 different models with the step fkt and i want to know which model is the most common. CODE: ... missStep -> numeric(100) for (j in 1:100) { trainindex <- sample(c(1:462),300) train <- data[trainindex,] test <-
2010 Sep 22
1
Bundler picking up wrong version of Ruby with Rails 3 ( possible bundler bug )
Hello All, I am developing a JRuby on Rails 3 application. Standard stuff. I am facing problems getting autotest to run. Here''s the trace: % autotest loading autotest/rails_rspec2 bundle exec /Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.22/bin/rspec
2008 Aug 23
1
Route segment ":controller" cannot be optional because it precedes a required segment.
Hi, With this route... map.namespace :admin do |admin| admin.sort ''/:controller/sort/:sort_by/:sort_dir'', :action => ''sort'' end ...I get this message... Route segment ":controller" cannot be optional because it precedes a required segment. This segment will be required. The route works as expected, but the warning is worrying. Any ideas?