Displaying 20 results from an estimated 10000 matches similar to: "Appending a String to A Field"
2006 Aug 09
8
AJAX image manipulation
I have this code in a controller that returns images to my browser...with
ROR.
def index
@products = Product.find_all_ pictures
end
....this is the .rhtml..
<% for photo in @pic -%>
<div class="entry">
<img src="<%= photo.image_url %>"/>
<h3><%= h(photo.title) %></h3>
<%= photo.description %>
2006 Jul 12
1
Question re: Computing a field in a DB record
I''m just learning Rails and have encountered a problem trying to set
a field in a DB record based on the value of another form input
field. Using the scaffold code, the create works as expected and the
update (edit) also works. However, one of the DB fields (amount) is
supposed to be computer from another (units): if the category field
is "Mileage", amount= units *
2006 Jul 07
7
Sequencing control with edit method in CRUD examples
I have been playing with the cookbook type of tutorials building a fish
tournament scoring piece and am having a bit of a problem with a DB
field called "points" in my "catch" table that is not input by the user
but is calulated based on a "size" field that is input by the user.
I have the following in my catch_controller.db
def new
@catch = Catch.new
@fish =
2006 Aug 09
1
Is this possible
Is it possible with ROR to dynamically create a javascript file which will
overwrite the existing file in the ''javascripts'' directory after a database
is updated?
Anybody know how?
Jim
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it''s FREE!
2005 Sep 19
1
help with has_one relationship??
Hi
I''m new to Rails and I''m struggling with a ''has-one'' relationship. I''m
trying to save product and image data in seperate tables with one to one
relationship. I''m assuming the problem lies in the controller method
below but can''t work it out. The models contain the has_one and belongs
to statements, and I tried swapping these
2006 Jul 13
1
error_messages_for
I can''t seem to figure out how to validate a few fields some1 please
help me out
model---------
class Record < ActiveRecord::Base
validates_presence_of :sw, :flex
end
controller------------
class RecordController < A;;icationController
def new
@record = Rrecord.new
@product = Product.find(params[''product_id''])
end
def create
2006 Jul 02
5
Question about setting field values for a belongs_to model
I have two tables, applicants, and skills where each applicant
"has_many" skills, and each skill "belongs_to" an applicant.
When I have a reference to an applicant and a (skill) id for one of
their skills, I thought to update their skills by using
@applicant.skills.find(id_of_skill).description = ''new description''
# even adding
2006 Apr 27
2
NoMethodError - why?
Getting this error when hitting update.
NoMethodError in Article#update
You have a nil object when you didn''t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occured while evaluating nil.update_attributes
Source code.
def create
@article = Article.new(params[:article])
@article.user = @session[''user'']
if @article.save
2006 Jan 15
0
update_attributes not working
I dont know if its me or the dodgy win-32 intall of ruby/mysql, but I
can''t seem to get update_attributes to work.
In my user controller, I have:
def update
@user = User.find(@params[''user'']["id"])
if @user.update_attributes(@params["user"])
flash["success"] = "Updated Successfully"
redirect_to :action =>
2005 Jun 02
0
Re: ttylinux and Error creating domain: vbd: Segment not found - new
Hello,
Thnks;
You are absolutely right.I changed it to point to
file:/root/ttylinux/ttylinux-xen , unmounted mnt
and had succeeded to create and log in to the new created domain.
Silly of me.
John
>Are you supposed to mount the filesystem under dom0 before you start
>ttylinux?
>From: Marius Hårstad Kjerkreit <mkjerkreit@gmail.com>
>Reply-To: Marius Hårstad Kjerkreit
2005 Mar 10
4
error messages, loops and saves, actionmailer and finaly authentication
Thanks to everyone who responded to my first set of questions. Not only did I
get my questions answered but I improved my code and learned a couple new
things.
I think I prefer the mailing list over IRC... easier to follow :-)
I have some more questions if you don''t mind. Some are Rails related and some
are Ruby related.
1) This is concerning displaying error messages. I am assuming
2012 Oct 23
1
parsing a structured object
Hi All,
Thanks in advance for your help. I take this to be a very basic
question, but I'm very new to R.
I'm trying to figure out how to parse an object. I have the following:
> fileLocation
location
1 foo.csv
> fileLocation$location
[1] foo.csv
Levels: foo.csv
What I want to get back is
2006 Apr 18
4
how would you take the duplication out of this?
i have these two really similar methods in my addressbook controller.
def edit_company
@company = Company.find(params[:id])
if request.post? and @company.update_attributes(params[:company])
flash[:notice] = ''Company was successfully edited.''
redirect_to :action => ''show'', :id => @company
end
end
def edit_person
2006 May 31
0
AGI MySql
thanks Billy. I replaced
print "STREAM FILE $filename \"\"\n";
with
print "EXEC PLAYBACK $filename \n";
and it worked fine. Interestingly when I did
print "STREAM FILE beep \"\"\n";
within the script, it worked.
If I wasnt a newbie to asterisk I wouldve thought this to be strange.
>From: "William Piper"
2006 Apr 19
1
validates_presence_of
Hi, having a few problems working out whats kicking off,
im using validates_presence_of :title in a models class
this seemed to work fine untill I used a custom new.rhtml
error message I am gaining is
NoMethodError in Recipe#create
Showing app/views/recipe/new.rhtml where line #15 raised:
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
2008 Sep 10
5
xmlhttprequest for updating
Hello,
I am updating an object with an AJAX form:
view:
<% remote_form_for(@sample, :update => "content2") do %>
<p>
parameter: <br />
<%= select("sample","parameter",Parameter.find(:all).collect {|p|
[p.description.gsub(''_'', '' ''),p.id]},{},{:size => 4, :multiple =>
true}) %>
2006 Jan 03
5
update command not updating DB
I really need your help guys... I spent 6 hours on this simple update
command today that should work. It works fine in my other controller,
but doesn''t work in this one for some reason.
Here is my controller code for the list view, and then the update
command:
======
def edit
@user = User.find(params[:id])
end
def update
@user = User.find(params[:id])
if
2005 Oct 26
1
how to get input fields (checkboxes)
Hello,
I was wondering what the easiest way would be to get all input fields in a
form - they all have the same id like toggle[] for instance.
how could I e.g. count them? would the getElements or getInputs work for
instance and how would I use them?
thank you
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today -
2007 May 03
2
Multiple Update Actions that are Relatively the same
Hi there,
I have 2 actions that are rather identical:
# Put /account/you/update_password
def update_password
@user = current :user
respond_to do |format|
if @user.update_attributes(params[:user])
format.html {redirect_to account_url}
else
format.html {render :action => "edit_password"}
end
end
end
# PUT /account/you
# Update
2006 Feb 28
0
Question abour Draggables & Droppables - my code example
hi i think my example is very simple and straightforward so i''m not sure if
it meets your needs (change revert:true to revert:false from a draggable
after I drop it on a droppable so it doesn''t return to its original place.)
i did this
# 2 divs created here
<script language="javascript">
new Draggable(''drag'', {revert: false});