I need to render view template by jQuery. I have template 'category.html.erb' and file 'category.js.erb' with following code:
$("#block").html("<%= escape_javascript(render :template => 'category') %>");
but it doesn't render category view template.
Please help me!
...
I'm having an issue installing the memcached ruby gem on my Mac Pro machine with OS X Snow Leopard (10.6.4).
Memcache is installed and working fine and for most projects I use the memcache-client gem without issue, but this current project I need to use the memcached gem instead.
Installing the gem with env ARCHFLAGS='-arch x86_64' gem...
Hello I have the followong struggle in my head. I want a text-field in which the use can type in some parameters, which will be used as filter-criteria for the :conditions hash in my find method.
I have created a helper, with takes an option and merge the hash to the options:
In my controller:
@bills = adminbill_filter(:limit=>params[...
hello,
I have one Class with 2 methods.
The first method is called by the view with some GET parameters ( params[:page] ).
I would like to save those params and send them by a render action to my second method.
class exemple
def first
## sql save of params[:page]
render :action => "second"
end
def second
##
## H...
Hello all.
I'm writing a reports dashboard for a rails app. The dashboard is for user data, and currently it's running multiple count an select queries to build the four or five reports on the page. I'm sure that there is a more efficient way to do this. How would I go about structuring the controller method so that it only runs one ...
Hi,
what are the Rails plugin/gem solutions for converting a .xls file into a .pdf file?
Thanks a lot for any feedback!
Tom
...
I am currently involved in the development of a large rails application that interfaces with another product via a custom API gem. This has led to a very strange sort of error catching. For instance, when we interact with the other product, it might return an authentication error, which we expect. We then catch that error in our API g...
Hi,
I've just updated my Rails gem version from 2.3.5 to 2.3.8
I'm using simple_form v=1.0
When I try to render a form I have an error message :
undefined method `html_safe!' for #
Can I patch it in my app or maybe it must be fixed in the simple_form version 1.0 ?
Thanks for your advices :-)
Fro_oo
...
I have some logic code that is literally cut and pasted across several different sites I own (it's code that interacts with a web API I've created). Considering that this isn't DRY and that when I update one thing I want it to update across all my sites I wanted to move this to a gem or a plugin. My main question is which one is the be...
Does anybody know how to silence or filter lines from the backtrace of a cucumber run? Im running a rails 2.3.5 App with the database_cleaner plugin set to truncate after each scenario. And every time one runs, the terminal gets flooded with useless "NOTICE truncate cascades.. blah blah" message.
I've tried using the config/initializers...
how do I change my activerecord model default behavior for the find method?
For example, i want to search for all books inside drupal nodes database, but drupal uses only one table for all data, and uses the 'type' column to find out the type
class Book < ActiveRecord::Base
set_table_name 'node'
def find(*args)
:conditions => {...
I am trying to port an existing rails app running rails 2.3.8 to
3.0.0beta4.
I currently use this paginate_by_sql hack
module ActiveRecord
class Base
def self.find_by_sql_with_limit(sql, offset, limit)
sql = sanitize_sql(sql)
add_limit!(sql, {:limit => limit, :offset => offset})
fi...
How do I validate that a model has at least one associated model using nested attributes? This has been driving me crazy as I am sure that I am missing something simple. For example, I want to require that a List always has at least one Task.
class List < ActiveRecord::Base
has_many :tasks, :dependent => :destroy
accepts_nested_at...
I see a similar question here. However, that is related to installing on non-windows platform. I followed the instructions here and get error when I execute the following:-
gem install rails
The error is following:-
ERROR: http://gems.rubyforge.org/ does not appear to be a repository
ERROR: could not find gem rails locally or in a ...
Excuse my daftness, but I can not understand how ruby vars can be attained with jQuery. I made a button that by json POSTS to the server to make a credit_status = 0. But I would like that 0 to also auto-update on the page as well.
My View:
HQ $
= organization.total_credit
= link_to 'redeem', redeem_admin_organization_path(organization)...
I have an application that accepts an address and writes it to the db. I then want to take that address and convert it to something I can send through Google Maps, so I need to replace all the spaces with "+" symbols. I understand how to do that with a regex:
address.gsub(/\s/, "+")
And can create a variable that does it, voila. But I...
So I'm connecting to SQL Server 2005 from my Rails app via the activerecord-sqlserver-adapter.
I'm able to execute stored procs by doing
Mymodel.execute_procedure("thisProcedure", param1, param2)
But I have a stored proc that has a SQL INOUT variable that I'm having trouble with. I execute it, and I'm not seeing that variable returne...
hi
I have a form that has a category model and and embeded docuement called "FieldModule" and this has embedded document called "SubFieldModule"
For example
class Category
include MongoMapper::Document
key :name, String
many :field_modules
end
class FieldModule
include MongoMapper::EmbeddedDocument
key :name, String ...
I originally posted a question relating to this problem on serverfault.com: http://serverfault.com/questions/152587/apache-mod-proxy-to-another-server
I have since realized that this is not an issue with my server setup, but my rails application. I have set this application up server-wise the exact same as another functioning rails app ...
Consider the following setup:
class Parent < ActiveRecord::Base
has_many :children
end
class Child < ActiveRecord::Base
belongs_to :parent
end
And this console session:
>> p = Parent.find 41
>> p.some_attr = 'some_value'
>> c = p.children.build
>> c.parent
By watching my log files, I can see that c.parent is querying the db fo...