i have a model named rawdata.rb pointing to a table
class Rawdata < ActiveRecord::Base
set_table_name "rawdatas"
i have setup my controller file named admin_controller.rb with the following
function.
def list_raw_data
sql="select * from rawdatas order by tradedatetime desc"
@rawdata_pages, @rawdata = paginate :rawdata, :per_page => 50
i have a model named rawdata.rb pointing to a table
class Rawdata < ActiveRecord::Base
set_table_name "rawdatas"
i have setup my controller file named admin_controller.rb with the
following
function.
def list_raw_data
sql="select * from rawdatas order by tradedatetime desc"
I assume that the inflection is used by the model only. i had setup the model
that the table name is set_table_name "rawdatas"
How can i fix the controller for the same?
i need some help to fix this problem
i have a model named rawdata.rb pointing to a table
class Rawdata < ActiveRecord::Base
set_table_name "rawdatas"
i have setup my controller file named admin_controller.rb with the
following
function.
def list_raw_data
sql="select * from rawdatas order by tradedatetime desc"
I assume that the inflection is used by the model only.
It's not.
i had setup the model
that the table name is set_table_name "rawdatas"
that's a separate thing
How can i fix the controller for the same?
Depending on your version of rails you can find inflector examples
either at the bottom of environment.rb or in one of the initializers
(in config/initializers)
I assume that the inflection is used by the model only.
It's not.
i had setup the model
that the table name is set_table_name "rawdatas"
that's a separate thing
How can i fix the controller for the same?
Depending on your version of rails you can find inflector examples
either at the bottom of environment.rb or in one of the initializers
(in config/initializers)
One other way would of course be to rename your model ( & the
associated file).
i found the inflections in the environment.rb and uncommneted it. i tried to
monkeypatch it like the following
Inflector.inflections do |inflect|
if not(inflect=="rawdata") then
inflect.plural /^(ox)$/i, '\1en'
inflect.singular /^(ox)en/i, '\1'
inflect.irregular 'person', 'people'
inflect.uncountable %w( fish sheep )
end
end
It still does not work. i also restarted the server to see ifit will take
effect but it did not. i want the controller to think that rawdata
inflection is still rawdata.
Any help is appreciated.
i need some help to fix this problem
i have a model named rawdata.rb pointing to a table
class Rawdata < ActiveRecord::Base
set_table_name "rawdatas"
i have setup my controller file named admin_controller.rb with the following
function.
def list_raw_data
sql="select * from rawdatas order by tradedatetime desc"
@rawdata_pages, @rawdata = paginate :rawdata, :per_page => 50
i found the inflections in the environment.rb and uncommneted it. i
tried to
monkeypatch it like the following
Inflector.inflections do |inflect|
if not(inflect=="rawdata") then
inflect.plural /^(ox)$/i, '\1en'
inflect.singular /^(ox)en/i, '\1'
inflect.irregular 'person', 'people'
inflect.uncountable %w( fish sheep )
end
end
Inflector.inflections do |inflect|
inflect.irregular 'rawdata', 'rawdatas'
end
(you do need to restart the server)
I've remembered paginate expects you to pass the the plural form, so
you need paginate :rawdatas
With the inflection you can drop the set_table_name
my controller function is here
def list_raw_data
@rawdata_pages, @rawdata = paginate :rawdatas, :per_page => 50
end
how does the controller know which view to render with the pages. the
example that i am mocking does not do a render action. i am getting a entry
page instead of a list page. should i add a render before the end of the
function above.