# find first foo
foo = Foo.first
# find next foo
next_foo = foo.next
# find next foo with defined sort column or conditions
next_foo = foo.next(:sort => :age, :conditions ...)
# previous function also.
previous_foo = foo.previous
#...
Devoting for Ruby, Rails and Web development
# find first foo
foo = Foo.first
# find next foo
next_foo = foo.next
# find next foo with defined sort column or conditions
next_foo = foo.next(:sort => :age, :conditions ...)
# previous function also.
previous_foo = foo.previous
#...
1 require 'win32ole'
2
3 module ModelDoc
4 def saveAs(filename)
5 self.SaveAs3(filename, 0, 0)
6 end
7 def save
8 self.EditRebuild3
9 self.ViewZoomtofit2
10 self.Save2 false
11 end
12 def setValue(parameter, value = 0.01)
13 self.Parameter(parameter).SystemValue = value
14 end
15 def closeDoc(docName)
16 self.CloseDoc docName
17 end
18 end
19
20 module SldWorks
21 def openDoc(filename, filetype = 1)
22 self.OpenDoc(filename, filetype)
23 activeDoc
24 end
25 def activeDoc()
26 self.ActiveDoc().extend ModelDoc
27 end
28 def exit
29 self.ExitApp()
30 end
31 end
32
33 def solidworks
34 begin
35 @sldworks = WIN32OLE.connect('SldWorks.Application')
36 rescue WIN32OLERuntimeError
37 @sldworks = WIN32OLE.new('SldWorks.Application')
38 end
39 @sldworks.extend SldWorks
40 end
OpenDoc6 ( filename, type, options, configuration, &Errors, &Warnings )
And in the controller , I done something like this:
map.resources :books,
:path_prefix => '/person/:person_id',
:name_prefix => 'person_'
map.resources :books,
:path_prefix => '/library/:library_id',
:name_prefix => 'library_'
if params[:person_id]
........
elsif params[:library_id]
.......
end
map.resources :books,Controllers changed nothing, then something wrong still.
:path_prefix => '/owner/:person_id',
:name_prefix => 'person_'
map.resources :books,
:path_prefix => '/owner/:library_id',
:name_prefix => 'library_'
map.resources :books,This time the parameter "params[:person_id]" didn't work at all when using the helper like "person_new_book(1)" , "person_books (1)",etc.
:path_prefix => '/owner/:library_id',
:name_prefix => 'library_'
map.resources :books,
:path_prefix => '/owner/:person_id',
:name_prefix => 'person_'