Displaying 20 results from an estimated 900 matches similar to: "Current controller"
2006 Aug 12
7
Override method in ActiveRecord
Hello,
there is a method ActiveRecord::Base#exists? . I would like to override
this method in a class ActiveRecord.
Could anyone tell me how to do it?
TIA
--
Posted via http://www.ruby-forum.com/.
2006 Mar 18
16
fixrbconfig - does it work on intel macs?
I''m trying now to do "sudo fixrbconfig" in the terminal, and I get this:
/usr/lib/ruby/1.8/powerpc-darwin8.0/ruby.h does not exist. This
probably means you haven''t yet installed Xcode from the Tiger DVD. You
won''t be able to compile Ruby extensions without it. Please install it
then rerun this program.
I''m on an intel mac. Am I unable to use
2006 Mar 20
3
rhtml templates and syntax
Hello,
where do we need <% -%> in templates ? What is the difference between
<%= %> and it ?
--
Posted via http://www.ruby-forum.com/.
2006 Apr 12
6
distinguishing mapped urls from ordinary action urls
I want to present different view depending on the url.
example below:
http://myapp/start/show?url=xZq
http://myapp/xZq
both addresses are controlled by a single controller and the same action.
the second url is only mapped in routes.rb
how can I distinguished the mapped url and present a slightly different view
in it?
Sabon
-------------- next part --------------
An HTML attachment was
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 18
9
How do I write this SQL the Rails way?
I''m trying to find all the unique bill_number, status records in Bills
table. I can do it with a find_by_sql statement like this:
@records = Bill.find_by_sql( "select distinct bill_number, status
from bills
group by bill_number, status;")
How would I rewrite it using ''find :all
2006 Mar 24
6
login forms , redirect_to and ajax-scaffold problems
Hi,
I have a standard type authentication technique direct from AWDWR, so there is a
before_filter :authorize_employee, :except => :login in my employees_controller.rb
the authorize_employee is in application.rb
def authorize_employee
unless session[:employee_id]
flash[:notice] = "Please log in"
# save the URL the user requested so we can hop
2006 Mar 30
13
Trying Agile book, found problem
Pg. 57 of Agile asks you to create a scaffolding by typing in
ruby script/generate scaffold Product Admin
Instead of generating everything, it only gives me
exists app/controllers/
exists app/helpers/
exists app/views/admin
exists test/functional/
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
identical
2006 Apr 20
5
How to find the last SQL statement executed in ActiveRecord
Is there a method for retrieving the last SQL statement executed by
ActiveRecord? I realize I can open the log file, but I''m looking for a
programmatic way.
--
Posted via http://www.ruby-forum.com/.
2006 Mar 22
3
Something wrong with content_columns
I have a database with a couple of tables. One table called spares has
foreign keys in another called equipment. When I create a new record,
it is added to the spares table however the list action does not show
all the columns in the table. It only shows those columns that are not
foreign keys. I am using the default action generated by scaffold for
list.
Why is that so? Do i need to re-write my
2006 Mar 24
6
Microsoft SQL Server has me stumped
I''m tinkering around with an old legacy table in SQL Server 2000.
Ruby 1.8.4, most recent ADO.rb file from RubyForge, Rails 1.0
Here''s the model:
class InventoryItem < ActiveRecord::Base
set_table_name "[_SMDBA_].[_INVENTOR_]"
set_primary_key "sequence"
end
Everything works fine. I can retrieve records without issue.
However, when create a new
2006 Mar 18
5
How would I get the previous id from the database?
I''m trying to get the id of the previous row prior to what would be
input and then rename an uploaded image to that row number.
So say the previous row was 19 and the image in that row was named
19.jpg, I''m wanting to name the next uploaded image as 20.jpg since the
row that would be added then would be 20.
Right now I''ve just got:
@new_tutorial =
2006 Apr 12
1
acts_as_list problem with records coming in and out
I have the model that acts as list
acts_as_list :scope => ''featured=1''
As you can see, I only need to order the records that are featured. However,
from time to time I switch some featured items off and mark others as
featured. When this is done, I start getting dublicate numbers on the list
and ordering starts getting problem...
What would be the good approach to
2006 Mar 16
3
ACLSystem and session variables
I am using the ACL System that is described on the Rails wiki and I have
a quick question. I want to set the "role" as a session variable so
that I can display certain navigation schemes and I was doing it like
this:
@session[:user][:role] = @user.roles
When I print out this variable I get:
#<Role:0x3262d80>
How can I turn this into a readable value? I tried .to_i
2006 Apr 21
4
link_to_function with submit
I looked everywhere but couldn''t find it.
I don''t want a submit_tag or image_submit_tag but a normal link that
submits my form.
Normally I would do this with a javascript like
function sendForm ()
{
document.forms[0].submit();
}
but this doesn''t work with form_remote_tag
link_to_function( ''Send'' , "sendform();")
So the question is:
2006 Mar 18
3
Weird stylesheet_link_tag issue after moving servers
Dear experts,
I am in the process of switching servers for my application.
Before the move everything was working properly.
After the move
<%= stylesheet_link_tag ''/stylesheets/styles.css'' %>
generates
<link href="//stylesheets/styles.css" media="screen" rel="Stylesheet" type="text/css" />
2009 Nov 09
3
How can I improve a Ruby on Rails code that hast a lot of SQL as strings?
Hello Railists,
I have a piece of Ruby on Rails code that has a complex SQL query (well, not
that complex, but as far as I know beyond the ORM capabilities) and for my
taste it has too many strings and harcoded values. I''d like to improve it as
much as possible, so my question is open ended, what else can I do to
improve it?
Some particular issues I have
- Is there a way to get a table
2006 Mar 22
2
How to bypass routing for a particular request?
I would like to set up some my app. to display a standalone HTML page -
not rendered through RoR per se.
Something like
render(:inline => some_Javascript_function...
then in the Javascript
some_Javascript_function,
I want to open up a popup with the URL I specify. However, because it
is a relative URL, it is going through the RoR routing algorithm. I
don''t want that - can I
2006 Mar 27
13
Is this a bug in Ajax handling?
When a controller responds to a link_to_remote with a redirect_to, the
link_to_remote gets a success callback, this would seem like a bug to
me, at a minimum it should return a failure?
This is driving me crazy because all the login engines/generators
respond to an authentication error with a redirect_to. The work around
is to change them to all do a
render :layout => false, :status => 500
2006 Mar 18
2
basic operations in rails
Hi all,
This must be such a beginner''s problem, but I can''t figure it out.
I''m pulling two integers out of a database, and i want to divide one
value with the other, but i keep getting an error about operating on
strings.
Here''s the code -
low_freq = unsorted.last.freq
high_freq = unsorted.first.freq
divider = high_freq / low_freq
In my view, if i display