Displaying 20 results from an estimated 2000 matches similar to: "help with unless"
2005 Jul 28
3
Help troubleshooting save
I done plenty of saves before in rails, but I must be missing
something simple with this. Can a fresh set of eyes take a look at
this and see why it is not saving:
def addcash(uid)
c = Trade.new
c.attributes = {"user_id" => uid,
"tradetype" => ''9'',
"cash" => 10000}
breakpoint
if
2006 Feb 09
6
troubleshooting an observe_field
Hi,
I''ve got a live_search field in a partial that is on several different
pages. On all pages, except 1, it works fine. On the page it doesn''t work
on, it seems it never executes it action.
Here''s my observe_field code inside the partial:
<h1><label for="searchtext">Live Search:</label></h1>
<%= text_field_tag :searchtext
2006 Apr 16
2
conditional updated_on update
Hi list,
I''ve got some counter_caches in a model. When these get incremented - say on
a page view - my updated_on column also gets updated. How can I
conditionally not update updated_on if just these counter_cache columns
change?
The problem with that is that I am using acts_as_versioned which clones the
record each time updated_on changes. I am successfully ignoring the
counter_cache
2006 Mar 15
7
Populating text_tag with serialized data
I am using a serialized attribute in one of my models The serialized data is
in the form of an array. I want to have a text_tag for each element
contained in my serialized attribute. How would I construct the text_tag?
My model name is ''questions''. The serialized attribute is "answers"
So I might have:
<% form tag %>
<% text_tag ''question'',
2006 Mar 24
4
validate if different?
Hi, I seem to remember seeing the equivalent of saving only if all
attributes are different. I can''t seem to find that now in the API or the
agile book.
I''m using the acts_as_versioned and only want to save if the input is
different.
Thanks,
Steve
http://www.smarkets.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Mar 31
4
javascript help
Hi list,
I have a list of tags. I want to be able to click on a tag and have that tag
name populate an input field. I think delicious used to allow you to click
on existing links to tag your bookmark similar to this (moving instead to
auto_complete).
My guess is the code looks something like this....
<form>
<input type="text" name="all" id="discover"
2005 Dec 19
1
New rails site. Beta testers need.
Hi Rails List,
I need some beta testers for my new site: http://www.smarkets.net. This list
is literally the first group to see it, so be gentle.
Smarkets is a prediction market for Amazon products. It takes Amazon
products and turns them into a stock. The price of these "stocks" move based
on the movement of its Amazon sales rank. If the sales rank goes up 10%, the
price of the stock
2006 Apr 17
3
help debugging an error
Hi, I''ve started getting an error I can''t debug. The error doesn''t generate
anything in my development log. A breakpoint set right at the beggining of
the controller method does not get triggered. It happens on a form
submission. I can make changes to the object model from with the console,
but not on this form submission. I thought maybe it was routing, because I
have
2005 Dec 26
2
resorting a dataset
Quick question to see how I might re-sort an Activerecord data set. Let''s
say I have this table:
tablename: testscores
| id | student | score | avg_for_year
1, steve, 85, 82
2, tom, 84, 92,
3, jim, 92, 95
In my controller, I have something like:
t= Testscores.find(:all, :order => "score DESC", :limit => 2)
...where it would return the records for Jim and Steve....
My
2006 Feb 10
3
robots.txt best practices
I''d been ignoring this error message in my log for a while:
ActionController::RoutingError (Recognition failed for "/robots.txt"):
I had never touched robots.txt. So I decided to make it a proper robots.txtfile
I found this great article...
http://www.ilovejackdaniels.com/seo/robots-txt-file/
...where Dave explains the ins and outs of the file.
Before I changed mine, I
2006 May 11
9
acts_as_commentable plugin
I''ve just about finished up work on a plugin similar to
acts_as_taggable, but for comments instead which would allow you to
attach comments (possibly even a threaded discussion if conbined with
acts_as_tree) to any object. Is there anyone that would be interested
in it? I don''t want to go throug the trouble of finding some way to
distribute it unless I know that there is a
2008 Apr 07
7
Saving attribute
Something is getting lost here.
def create
@home = Team.find_by_user_id(current_user.id)
for player in @home.players
player.update_attribute(:game_id, @game.id)
end
end
def show
@players = Player.find_all_by_game_id(params[:id])
end
view
<%= @players.size %> # mistakenly equals zero
Played with the console and everything should be working fine...
2005 Dec 21
7
use of SET command in find_by_sql
Hi,
I''m trying to execute something like this method in a model:
def self.sql_for_rankings()
sql = "SET @counter:=0;"
sql << " SET @counter:=0;
SELECT *, @counter:=@counter+1 AS rank
FROM testscores. "
find_by_sql(sql)
end
Where the new rank column is a kind of autoincrementer inside of
2006 Apr 02
3
updating the dom
Hi list,
Say I''ve got a page that lists the students names and grades. Grades are
clickable using a form_remote_tag that then renders a new partial on the
right hand side of the page that then lists the individual test scores for
the particularly student. So far so good.
And lets say in the newly rendered right-hand section, I have another
form_remote_tag that will allow me to input a
2006 May 29
4
Time-based cache fragment expiration
Hello,
I''m trying to figure out how I could implement fragment caching that
expires every x amount of time. I thought of writing a runner script
that would expire the cache and set it as a cron job, but that
doesn''t really work because runner scripts act on models and not
controllers.
Does anybody have any ideas?
Regards,
-carl
2006 Apr 02
5
adding primary_key to join table using migrations
Hi list,
My tag_question_user join table is not currently a full-blown model. It
doesn''t have a primary key - just tag_id, question_id, and user_id.
I now want to add a primary key to this model (because I want to add a
"description" column as well so users can describe the tag.
I''m not sure how to add this using migrations.
Here is what I have:
class AddNotesToTags
2008 Mar 12
3
undefined method `each' for #<Usrecart:0x46d1678>
I have the an error such as undefined method ''each''
pls can any one find the error from the code given below
<center><%=@b%></center>
<center><h2>WELCOME IN YOUR PROFILE</h2>
<%@usercart=Usrecart.find_by_user_id(@b)%>
<%if @usercart.blank?%>
<br>
<br>
<br>
<br>
<h2>THERE IS NO
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 =
2006 Jan 12
3
what about Austin railers?
If Tuscon has some rail users, I know there must be some other Austin
railers out there. Have I missed some meetings that I didn''t know about?
Steve
http://www.smarkets.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060112/c2723541/attachment.html
2006 Mar 20
3
help: acts_as_versioned setup error "undefined local variable or method ''base_class''"
Hi All,
Rails newbie here trying to set up acts_as_versioned according to Chapter 14
in the Rails Recipies book. I''ve taken the following steps (nearly
verbatim) as mentioned by the book:
- created the target model "Post"
- added the "acts_as_versioned" label to the model file
- generated a migration file
- added the table creation code and the command