I am using jqgrid with Ruby on Rails using the 2dc_jqgrid plugin -- 2dc_jqgrid details).
By default, the plugin seems to take information directly from the fields in your model and display them in the resulting table. For instance:
books = Book.find(:all) do
if params[:_search] == "true"
id =~ "%#{params[:id]}%" if params[:id].p...
Hi,
I want to render action inside my erb template.
<div>
<%= render :controller => :tags, :action => :tag_cloud %>
</div>
This block throws exception: undefined method `formats' for nil:NilClass
Also I want to tag_cloud action to be rendered from cache. Is that possible?
Regards,
Alexey Zakhaov
...
I used to put Global variables in environment.rb with my Rails 2.3.8 application such as:
MAX_ALLOWD_ITEMS = 6
It doesn't seem to work in Rails 3. I tried putting it in application.rb and that didn't help.
What do you suggest?
...
Let's say, I connected the route / to WelcomeController's index action.
Inside of the index.html.erb-Template I want to display the path of the template from Rails.root upwards, ie.
<h1> We are rendering: <%= how_do_i_do_this? %></h1>
to render to
<h1> We are rendering: app/views/presentation/index.html.erb</h1>
In Rails 2 I cou...
I have done a few projects using Ruby on Rails. I am going to use JRuby on Rails and hosting it on GAE. In that case what are the stuff that I need to know while developing JRuby apps. I read that
JRuby has the same syntax
I can access Java libraries
JRuby does not have access to some gems/plugins
JRuby app would take some time to load...
Hi,
I am faced with an issue in Ruby on Rails. I am looking to convert a string of format Tue, 10 Aug 2010 01:20:19 -0400 (EDT) to a date object.
Is there anyway i could do this.
Here is what I've looked and tried at the following with no luck:
Date.strptime(updated,"%a, %d %m %Y %H:%M:%S %Z")
Chronic Parser
Ruby: convert string to ...
I'm struggling to model a particular relationship with ActiveRecord. I currently have the following setup and working
class Schedule < ActiveRecord::Base
has_many :tasks
end
class Task < ActiveRecord:Base
belongs_to :schedule
end
with a database structure that looks like this:
schedules
- integer:id
tasks
- integer:id
...
Hi,
I have some code in one of my views like this. I feel that it has too many if else conditions. All it does is checking for the ActiveRecord Object's status and setting the image. Is there a better way to do the following in Rails?
<td class="notification_msg">
<% if notification.status == NOTIFICATION_STATUS.index("Failure") %>
...
I had always dreamed about learning rails and the ruby language, but there seems to be a big change comming with the new rails 3 release. So are there generally huge differences between 2 and 3? Should i probably start with rails 3 when books are available since this is the way i learn the best?
...
Hello,
I'm currently creating a Rails app with some cronjobs etc, but I have some problems because the sql is cached by Rails.
So anyone know how to disable the SQL Cache in Rails? Not globally, but for this code. Really don't want to create one method for every model, so is there anyway to just disable it temporary?
Terw
...
We want to start letting our users help us test our feature changes before a wider release. Our rails app already has roles but I don't know how to we should go about implementing a beta feature without moving the whole app over.
Some issues I can't think of solutions to:
A beta feature may require a database migration. How can yo...
How to pass parameters sql query in find by sql
...
I'm looking to create a custom validation in Rails. I need to validate that a POSTed start_date_time and end_date_time (together) do not overlap that combination in the database.
Example:
In the database:
start_date
05/15/2000
end_date
05/30/2000
POSTed:
start_date
05/10/2000
end_date
05/20/2000
FAILS!
Here's the rub:
...
I like Rails, but I'm not a big fan of migrations.
How can I use the ActiveRecord::Scema tool to create a database without using SQL and without migrations?
I know you use it like this:
ActiveRecord::Schema.define do
create_table :authors do |t|
t.string :name, :null => false
end
add_index :authors, :name, :unique...
I write a helper method in applicationhelper something like this
str = f.text_field(:username) + "<div class='error'>username is wrong </div>"
then in my view.rhtml it shows like this
<input type="text" value="" size="30" name="user[username]" id="user_username"> <div class="errors">username is wrong</div>
an...
I have a comments controller with index and create actions among others. Both those actions respond to html and js format.
Whenever I got create request via ajax, I would like to add new comment and then redirect to index.js, so the comments on screen are updated without reloading the page.
This sort of thing works flawlesly in Chrome...
I'm working on Ruby on Rails 2.3.8 and I've installed TinyMCE (last version). For a start, it displays correctly on my website, but I found out it cannot show embedded videos. So, I googled for this, but no luck.
Does anybody knows how to accomplish this?
...
Hi, stack trace is not showing like it should (in the browser). Instead I get public/500.html rendered. The problem seems to be recreated when I created a new rails project and apply the haml plugin. Originally I though it was this ruby script causing the problem:
class ToHaml
def initialize(path)
@path = path
end
def convert...
I am integrating facebook connect with my application which uses authlogic, facebooker, and the authlogic_facebook_connect plugin. After I log in with facebook, I get redirected to the front page of the site (as per my code) - but the page never loads! - it hangs.
Looking at the development log, I see that something is continuously tryin...
This is my common model which has no table.
class CommonActiveRecord < ActiveRecord::Base
self.abstract_class = true
def before_validation
set_blank_attributes_to_nil(@attributes)
end
end
My other models look like this ..
class BalanceName < CommonActiveRecord
def before_validation
super
end
end
I want to fet...