similar to: Route segment ":controller" cannot be optional because it precedes a required segment.

Displaying 20 results from an estimated 10000 matches similar to: "Route segment ":controller" cannot be optional because it precedes a required segment."

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 Jul 20
3
sort_by with via a parent models child
I am having a problem with ruby''s sort_by function. I want to sort a list of parent model objects based on the children of the parent models. Normally you might say sortedList = modelList.sort_by { |model| model[''someAttribute''] } What I am tring to do is sortedList = modelList.sort_by{ |model| model.children.find(:first, order=>"price desc" ).price}
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 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 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
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 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
2007 Nov 16
2
[Fwd: pxelinux doesn't suppress common prefix if nothing precedes double colon]
Just a reminder that this remains an issue up to and including the latest syslinux 3.53-pre (0x473cfc9c). Additional testing suggests that implicit hostname/IP has never worked, ever since the common prefix suppression feature was added in version 3.00. -------- Original Message -------- Subject: pxelinux doesn't suppress common prefix if nothing precedes double colon Date: Sat, 25 Aug
2008 Oct 28
7
aasm callback order?
Hello! Sometime ago I ran across a webpage where someone had identified the full callback sequence for an object lifecycle including AASM with it''s :enter and :exit and whatnot callbacks. Unfortunately, I can''t find it and searches don''t seem to help. Does anyone have a reference to a page that shows the callback sequence with Acts As State Machine (the gem)? I think
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 =
2008 Apr 16
3
Linking to "Next Entry >>" from the current Entry Page
Hi all, I''m trying to link to the "Next Entry >>" from the current entry page (in show.html.erb). Any one know how I would do it? -- 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
2007 Aug 26
1
pxelinux doesn't suppress common prefix if nothing precedes double colon
Contrary to the pxelinux.doc documentation, the common filename prefix is only suppressed if an explicit hostname or IP address precedes the double colon, e.g. 192.168.1.1::/foobar. A tcpdump of TFTP requests reveals that the double colon does nothing in implicit case (::/foobar is the same as /foobar, i.e. gets mapped to /pxelinux//foobar or whatever). 0.0.0.0::/foobar also does this. I
2007 Oct 15
6
SQL injection with :order, :limit, :group
I know how to avoid SQL injection attacks when you use :conditions User.find :first, :conditions => ["login=?", params[:username]] but how about with :order, :limit or :group? # uh-oh...spaghetti-oh User.find :first, :order => "login; delete from users; select * from users" Pat --~--~---------~--~----~------------~-------~--~----~ You received this message because you
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
2006 Aug 02
2
Ajax_Scaffold display from link table
Hi, Ive followed the pets/people ajax_scaffold example without any problem. I have a table documents and each document has a category. In the documents table i have a field called category_id. So in the documents grif i want to display the corresponding catgory name and when it comes to adding a new category or editing the have a drop down list to select from. category.rb require