Displaying 13 results from an estimated 13 matches for "asset_id".
2006 Apr 24
2
Checkboxes - Saving a Checked record to another table
...". Next
to each record i have a checkbox. When this box is checked i want to be
able to save the id of the record into another table called
"flagged_assets". All I need is the ID, nothing else. Im struggling
with the logic to save to another table. I know how to do it if the
asset_id is already in the "flagged_assets" table.
# when flag_assets page is loaded
def flag_assets
@assets = Asset.find :all
end
# Called when Ajax form is submitted
def get_flagged
to_flag = params[:to_be_flagged]
if to_flag
to_flag.each do |asset_id, flag|
@asse...
2008 Aug 01
2
image_path without timestamp
Every time I use an asset tag helper, there is a parameter appended to
the end of my file name.
e.g. <input src="/images/search.gif?1213816620" type="image" />
From what I am reading, this appears to be a timestamp for caching
purposes. It works in most cases, but I want to use image_path to embed
a flash file.
.swf file in public/images/flash
e.g.
2011 Jun 04
0
Rails 3.1 : Complex database query with Arel 2
...rs and OrderLines and I want to
get asset name, the stock, the quantity that is ordered and the
difference between the two previous.
I''ve manage to do it in pure SQL. (tested on postgres)
select assets.name, stock, ordered, (stock - ordered) as available
from
assets
join
(
select asset_id, sum(quantity) as stock
from "deposits"
where validated = true
group by asset_id
) as stocks
on assets.id = stocks.asset_id
join
(
select asset_id, sum(quantity) as ordered
from order_lines
join orders on orders.id = order_id
where state in (''I...
2008 Jun 11
1
Resourse route in namespace with prefix error
...st of buys
then I try to open this route http://localhost:3000/trades/1/buys
I get a strange error:
ActionController::RoutingError in Trades/buys#index
Showing trades/buys/index.html.erb where line #12 raised:
trades_buy_url failed to generate from {:contract_id=>#<Trades::Buy
id: 5951, asset_id: 309, type: "Buy", contract_id: 1, investor_id: 1,
date: "2001-09-30", trade_status_id: 1, is_future_operation: false,
quantity: #<BigDecimal:7fb8004,''0.2E2'',4(8)>, price: #<BigDecimal:
7fb7fb4,''0.623E1'',8(12)>, total: #<BigDeci...
2009 Mar 25
0
Optimise this association?
...tinct resources that are associated with any of its assets". (I
don''t care about position in this case)
I can think of ways to do it, eg
has_many :resources, :finder_sql => ''select * from resources where
resources.id in (select items.resource_id from items where
items.asset_id in (select elements.asset_id from elements where
elements.lesson_id = #{id}))''
But this feels dirty and in fact doesn''t even work - it''s complaining
about the brackets which seem to be getting broken when it inserts a
''count(*) from elements'' segment in...
2007 Aug 30
3
has/belongs to many sql error
I have a model Asset which has_and_belongs_to_many :tags. Tag has only
one field, name. There is a table assets_tags which only has an
asset_id and a tag_id.
I can add a tag to one asset. If I try to add the same tag to another
asset though (asset.tags << tag) I get this error:
Mysql::Error: #23000Duplicate entry ''4'' for key 1: INSERT INTO
assets_tags (`tag_id`, `id`, `asset_id`) VALUES (4, 4, 1)←[0m
Any ideas w...
2007 Jun 26
4
Can I stub a method on a belongs_to association:
...settings
before(:each) do
@asset = assets(:test_asset)
@mock_hook = mock("hook")
@asset.video.stub!(:hook).and_return @mock_hook # error occurs here
end
it "should call the delete hook" do
@mock_hook.should_receive(:update).with("test_video", :asset_id =>
@assetid, :asset_action => "destroy")
@asset.destroy
end
end
NameError in ''Asset when destroyed should call the delete hook''
undefined method `hook'' for class
`ActiveRecord::Associations::BelongsToAssociation''
I''m not sure why...
2007 Sep 06
4
HABTM association with own class?
If I have a class, Asset, which has and belongs to many associated Asset
objects, how do I do this?
has_and_belongs_to_many :associated_assets, :class => "Asset",
:foreign_key => ?????, :association_foreign_key => ?????
Right now, my table has a :first_asset_id and a :second_asset_id, but I
don''t see how the objects themselves are supposed to distinguish one
from the other.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups &qu...
2013 Feb 24
1
Use of the newdata parameter in the predict.coxph function
...Any insight here would be very helpful.
I'm using the same data as above.
I'm assuming, based on the documentation, that collapse is just a vector of
the subject ID's to aggregate
the hazard function by subject ID but it's not working. I created a simple
dataframe
called collapse:
ASSET_ID
1 260
2 263
but the predict function is complaining about one of the covariates:
*predict(cox_out,type="expected",collapse)*
*Error in eval(expr, envir, enclos) : object 'Meter3.Value' not found*
[[alternative HTML version deleted]]
2005 Dec 20
0
validates_uniqueness_of on has_and_belongs_to_many
...ded to a category. However, they could be added again to a different
category. Finally, an asset can be shared across many categories. So
my question is how do you check the uniqueness across a join table?
This does not compile....
has_and_belongs_to_many :categories, :foreign_key => ''asset_id''
validates_uniqueness_of :data, :scope => ''asset_categories.category_id''
Thanks,
Mark
--
--------------------------------------------------------------------
I am Mark Daggett and I approve this message.
2007 Nov 08
0
Dynamic relation with eager loading
A model has 2 columns in its table
asset_type_id
asset_id
the asset_type_id links directly to the table asset_types via a
belongs_to
asset_types contains a single column ''name''
method_missing in the model says when you call a method matching
/^asset.*/
call the corresponding method substituting ''asset'' for the conten...
2010 Apr 05
0
Risk Assessment Application
...oupled with the
likelihood of these threats being actualized to determine a risk
value, which, if above a certain threshold, will necessitate a
Treatment applied to that asset/threat pair.
table: Assets
columns:
- id
- name
- impact
table: Threats
columns:
- id
- name
- likelihood
- asset_id
table: Treatments
columns:
- id
- iso_27002_number
- threat_id
- justification
This will be my starting point. Any comments or suggestions are
happily appreciated!
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To pos...
2008 Mar 13
3
Refreshing a page gives a "stack level too deep" error.
I''m converting our app into restful rails. A couple of my classes
(Resource and Asset) have a has_many relationship with each other -
here''s the routes:
map.resources :assets, :has_many=>[:resources]
map.resources :resources, :has_many=>[:assets]
I''m getting something weird in my view pages. When i go to
/resources/4/assets
it works. I go to the page