Displaying 20 results from an estimated 10000 matches similar to: "Finding out where a variable is defined"
2007 Apr 19
2
invalid geometry string in change_geometry
I get the following error at the browser:
ArgumentError in ImagesController#upload
invalid geometry string `110×''
... for the call to change_geometry with an explicit size (''110x'') as
the geometry string:
def make_thumb (the_img)
require ''RMagick''
size = "110x"
debugger if ENV[''RAILS_ENV''] ==
2009 Dec 23
8
Where did this value in a form come from?
Newb here.
I have a form and a value that is being displayed ... and I have no idea
where the value came from.
I have done a
<%= debugger; '''' %>
in the form and, indeed, the debugger stops at the statement.
I have tried to trace through the code to see where the value came from
... and I gave up.
So ... what in Rails initializes the fields of a form?
--
Posted via
2009 Dec 25
18
rescue_from ActionController::RoutingError II
OK ... so I''m not supposed to use it but ...
Why doesn''t rescue_from ActionController::RoutingError work witht he
code from
http://www.rubyplus.org/episodes/20-Extended-RESTful-Authentication-Rails-2-App.html
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
# See ActionController::RequestForgeryProtection for details
2010 Jan 12
8
tips on how to write a controller test for models associated with currently logged in user
I have a controller test here:
http://gist.github.com/275616, which works fine when account is an
independent model, however I want:
an account to be a property of user, ( and created and associated when
a user is)
when the user goes to /account/edit it should on edit the account of
the logged in user -
I can make rails do this, but I''m utterly baffled how I should alter
this test to
2010 Sep 16
3
Resyful authenticatio current_user in model
Hi,
I am using Restful authentication for user authentication.
I want the current logged in user object in my model property.rb
Problem is current_user is not working on model.
How can I fix this I need that?
Please help me out.
Thanks,
Mike
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"
2009 May 14
3
Mysql query is not working
Please,
Can anyone help me to execute this query?
SELECT * FROM table WHERE customer_id IN (SELECT IF(1 <> 2,''SELECT
customer_id FROM customers'',''SELECT customer_id FROM company''))
Regards...
--
Posted via http://www.ruby-forum.com/.
2010 Apr 20
5
Spring Cleaning
Right now in my view, I have a whole HUGE clump of
<% if current_user %> and then <% if current_admin %> and then <% if
current_teacher %> and then all that other stuff in my view.
I have a ginourmous chunk of if and else statements in my views... is
there a way to make it prettier? The if and else''s almost all have the
same functions, expect for some minor changes.
2010 Apr 16
4
DEEEEPLY nested
Hello,
i have "a" has many "b", "b" has many "c", and "c" has many "d"
Now... "d" is a user model, and I have a current_user helper method
defined.
If i navigate to an "a" show page, how can I make sure that my
current_user ("d") is part of that "a"? meaning how can i make sure
that
2010 Feb 04
3
Checking column in table to see if value exists?
Hey all,
What if I want to check a column in a table to see if a value exists and
if it doesn''t, then update the existing record with the specified value
and if it does exist increment by 1 from the previous incrementation of
the value. And do it using the model (or controller if it''s unable to be
done in the model). Something like this:
def test!
update_attributes
2010 Jan 25
9
skinny Controllers, fat models with REST?
Hi,
I''m really new to rails, so i programmed some stuff and today i read
some things about skinny Controllers, fat models.
My Controllers are really fat now. So i''m asking myself how can i
shrink my controllers and move the code to the models, especially in
fact of REST e.g. in focus on error codes?
code example:
# POST /tasks
# POST /tasks.xml
def create
@authorized
2010 Aug 16
8
Executing js.erb file with :format =>'js'
Hi, I''m trying to get my javascript to execute after clicking a link on
my page using :format => "js" here''s my link:
<%= link_to image_tag("/images/icons/user_add.png"),
add_contact_path(:profile_id => profile.id, :url => request.url, :format
=> "js"), :title => "Add person to your contacts"%>
in my controller i have
2010 Feb 10
2
undefined method 'state'
I can''t imagine what I''m trying to do is complicated at all in Rails.
Yet, I am now getting this error: undefined method `state'' for
:StudentFailState:Symbol.
student.rb
has_one :student_fail
attr_accessor :student_fail_attribute
#controller
def student_fail
@student = @student.find params[:id]
def update_student_fail
@student.build_student_fail
2008 Oct 13
10
Shibboleth
Can anyone direct me to a really good tutorial on Shibboleth integration
with Rails, or indeed some sample code? I''ve been tearing my hair out
all day on this one.
Thanks
RobL
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2011 May 16
2
Cannot get multipart => true , running well in my form when using remote => true
I have a simple form , with a file field
= form_for (Clip.new), :html => {:multipart => true} , :remote =>
true , do |f|
= f.hidden_field :user_id, {:value => current_user.id}
= f.text_field :name
= f.text_area :description
= f.file_field :image
= f.submit I18n.t(:add)
generating the html code
<form accept-charset="UTF-8"
2010 Jan 20
4
Searching an array
Hi everyone! :)
I''m currently accomplishing what I want, but I''d like to clean it up a
bit. I''ve placed the following items in an array (please excuse my lack
of proper syntax):
@widgets =
[1, red]
[2, blue]
[3, red]
[4, blue]
I''d like to learn a way to search through the @widgets variable an
separate the widgets, so that I could have:
@blue_widgets =
[2,
2010 Dec 21
5
Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
Hey all,
I know that this:
Called id for nil, which would mistakenly be 4 -- if you really wanted
the id of nil, use object_id
means that I have an instance variable that has not been initialized.
However, I''m a little confused as to what to do in a signup form for
form_for:
<% content_for :login do %>
<% form_for @user, :url => { :action => "login" } do
2010 Sep 11
10
Having difficulty with threaded comments, using acts_as_tree
I''ve been having problems making threaded comments for the last few
days. Mainly with creating children and displaying the children.
Currently, I have comments shown at the bottom of my articles show view.
The top level comments work, but I do not really know how to implement a
way for users to "reply" to the top level comments and take them to a
form (the comment
2010 Feb 10
16
nil object - can anyone help?
Hi there,
I''ve been looking for a while now and can''t seem to find where I''m
going wrong..
I''m following a railscast tutorial to send invites out to people.
there''s n invitation.rb page:
class Invitation < ActiveRecord::Base
#attr_accessible :sender_id, :recipient_email, :token, :sent_at
belongs_to :sender, :class_name =>
2009 Feb 17
3
Dynamic select box
Hi everyone,
I have a problem. I want to display a different select box wether the
current user is an admin or an user.
So I thought I could do this in my view where my form is displayed :
<p class="form-input">
<%= f.label(:role_id, ''Role:'') %>
<%
if (current_user.admin?)
then collection_select(:user, :role_id, Role.find(:all, :order =>
2010 Jun 16
4
firebug jQuery undefined message in rails app
In rails app, I add the following line of code in application.js and I
get jQuery is not defined in firebug console.
In application.html.erb, I have the following:
<script type="text/javascript"
src="../javascripts/application.js"></script>
<script type="text/javascript"
src="../javascripts/jquery-1.4.2.js"></script>
and I installed