Displaying 20 results from an estimated 30000 matches similar to: "name space and before filter"
2008 Oct 08
11
Using image_tag and send_data
I am using image_tag to load an image that I''ve saved to the database
(using attachment_fu if you''re curious but that''s probably not
relevant here):
VIEW
<%= image_tag ''/photo/get_image/5'' %>
CONTROLLER
def get_image
@photo=Photo.find(params[:id])
send_data(DbFile.find(@photo.db_file_id).data,
:type =>
2008 Apr 16
8
Will acts_as_taggable_on_steroids and better_nested_set work together?
I am having this crazy problem where it ONLY shows up in testing.
This is my test code
<code>
def test_should_destroy
task1 = Task.new(:description => "tmp",
:done => false,
:user => User.find_by_login(''admin''))
assert task1.save
assert task1.destroy
end
</code>
This is my task model
2008 Oct 08
9
Plugins and the test environment
Hi guys. I''m writing a plugin for use in the test environment.
However, when I run ``rake test'''' or ``rake spec'''', RAILS_ENV is set
to "development" when my plugin''s init.rb is run.
How do you configure a plugin to load require a file in the test
environment?
Thanks,
Nick
--~--~---------~--~----~------------~-------~--~----~
You
2008 Aug 24
11
link_to_function check javascript attribute
How could I check the value of an javascript object''s attribute?
<div id="new_item_details" style="display:none"></div>
<%= link_to_function("Show details...", nil, :id => "show_details") do
|page|
page.visual_effect(:toggle_blind, :new_item_details)
if (page[:new_item_details].style.visibility ==
2009 Mar 25
11
ActiveRecord: Nested :include erroneous behavior
Hi,
Found a simple example breaking on moving to 2.2 from 2.0. This
example illustrates the usage of nested :include finder options.
class Book < ActiveRecord::Base
has_many :distributors
end
class Distributor < ActiveRecord::Base
belongs_to :book
has_many :agents
end
class Agent < ActiveRecord::Base
belongs_to :distributor
has_many :shops
end
class Shop <
2008 Apr 17
4
Do I need to use sessions if I don't store anything in them?
Hi,
I got very small app that has user part and admin part. The problem is
that after a while the sessions table has ~150mb. I don''t really need
to store any user data in the session for the user part. I only need
it for the admin part.
Can I simply turn session off in controllers from the user part? Are
there any drawbacks of turning the session off?
Regards
2008 Feb 27
7
older version of rails -- Unknown action error
Hi,
I''m using Rails 1.2.3 (constraint of the hosting company). I''m
getting this error
Unknown action
No action responded to subscriber
upon visiting http://mydomain.com/super_admin/subscriber/search
I have these files:
app/controllers/super_admin_controller.rb
app/controllers/super_admin/subscriber_controller.rb
app/views/super_admin/subscriber/search.rhtml
and below is my
2008 Sep 02
7
Deploying My Rails App
I have just finished my first Rails application following the
lynda.com tutorial, but I am not sure how to get my application on the
internet.
I have an ftp account through the applemachine server, but from what I
have read, I''m afraid I will not be able to host my application there.
What I am looking for is step by step directions on how to get from a
working Ruby on Rails application
2011 Aug 05
6
"bundle install" fails because of git gem
Hey everyone,
I''m having an incredibly difficult time getting bundle to work
properly on my production server.
My production server setup:
Ubuntu 10.04
Ruby 1.9.2p290
Rails 3.0.4
Passenger
rvm 1.6.32
My Gemfile (relevant parts):
gem ''linkedin'', :git => "https://github.com/renatosnrg/linkedin.git"
Whenever I try to do "bundle install" I get this
2009 Sep 09
5
Newbie question: undefined method 'number_with_delimiter'(probably configuration problem)
Hi all:
i am using gem to insall rails 2.3.3 and using $rails myapp to
generate my application, but strangely i can''t use the number_helper
below is my env:
export RUBY_HOME=$HOME/ruby
export GEM_HOME=$HOME/gems
export RUBYLIB=$RUBY_HOME/lib:$RUBY_HOME/lib/ruby:$RUBY_HOME/lib/
site_ruby/1.8
export PATH=$HOME/gems/bin:$HOME/ruby/bin:
and:
$ locate number_helper.rb
2009 Aug 04
6
forms, javascript and ajax - hopefully an easy question
Right now I have a simple form hooked up. Now that the form is smooth
and functional, I want to add a feature that I''m not sure how to
implement.
After a user modifies a form, I''d like to have a visual cue appear
somewhere to show that the form has been changed and needs to be
saved.
It could be a red div at the top of the screen - anything - it is
doesn''t matter.
Just
2007 Nov 20
2
After Filter Runs Even When Chain Is Halted
For a particular set of actions, I have a before and an after filter.
When the before filter returns false, however, the after filter still
executes (which I can tell because an error is being thrown from it.)
I know the before filter successfully returns false, because the logs
show that the chain was halted.
What could be causing the after filter to run despite the halting of
the chain in the
2008 Oct 03
7
form_remote_tag and :with
I am trying to pass the result from a javascript function along with
the result from a text_field with form_remote_tag. This is what I
have so far, but no go:
<% form_remote_tag(:url => {:controller => ''requests'', :action =>
''create''}, :with => "''data=''+request()", :update => ''request_sent'' )
2009 May 11
7
Upload file with url parameter
I want to upload file using get method.
for example, "http://www.mydomain.com/upload?file=c:\test.exe" upload
my local file to the remote server.
I found one useful link about file uploading here(http://
www.tutorialspoint.com/ruby-on-rails/rails-file-uploading.htm).
Even I''ve changed some code in order to fit my rails version, it
worked well. But the problem is I have use
2008 Dec 05
4
Replicating Form Behaviour in Functional Test
Hi,
I''m really struggling getting a controller test to pass while the form
that uses the method operates correctly.
I would really welcome a second pair of eyes to help me find out what
I''m missing.
The test
def test_set_password
@request.session[:user] = users(:admin)
put :set_password, :id => users(:one).id, :user => {:password =>
"newpass",
2009 Jan 05
5
ROXML versus simple to_xml
How they differ?
Does the to_xml method of the classes array/hash/object is based on
ROXML lib?
As I see in http://roxml.rubyforge.org/#quickstart, roxml needs we
define the class (class Book in the guide) before to convert a object
to xml. Moreover, the method to_xml (when not using "include ROXML")
just accepts any existing object, what is much suitable.
I need to compare and tranfer
2009 Mar 01
15
Ajax in Rails
Hi All,
New to the group, and new to learning rails.
I''m having some trouble, i''ve done a few tutorials on creating some
small apps with rails and am now starting to play around myself.
I''ve been trying to create a simple form which when a user enters any
data that data is displayed as a preview elsewhere on the page
instantly, just like when creating an advert with
2009 Mar 05
7
issue with the object cache
Hi,
I am getting a method_missing error when I run my application in the
production environment unless I set config.cache_classes = false in
config/environments/production.rb. This happens in Rails 2.2.2 but not
in Rails 2.1.0. The method that is missing is one I used to have
before I edited by hand the migration that creates the table
associated with the object (I know you are discouraged to do
2011 Feb 27
10
How to store the same key multi times in a Hash ?
given an Arra tags[]
I need to produce a resulting Hash as following ..
{ "$in" => [tags[0]], "$in" =>[tags[1], ...}
in which the key should be always the same and the value being an
Array
I tried this :
myHash = {}
tags.each do |tag|
h = {"$in" => [tag]}
myHash.merge!(h)
end
but the merge! is only
2008 Jul 09
4
Auto Postback in Ruby On Rails
in some other language have a concept e.i "auto postback"
So, in Ruby on rails is there any such option e.i "auto postback"
or same as "auto postback"
basically what i want ot do is that i have 2 select box
One for "Industry" and other for "Chemical"
1st we show all the industry in "Industry" select box.
if we select any 1 industry