I'm trying to setup an ajax-based website that loads a fragment of a webpage when a specific combination of GET variables and HTTP Headers are given.
GET /normal/html/page?ajax=true
X-ajax: true
What I've setup in my controller is:
before_filter do |controller|
if request_by_ajax?
ApplicationController.layout false
end
end
...
This may not be a big problem but I find this one as irritating. I wasn't able to figure it out. I have anchors in my site using link_to and even normal tags. Example:
<a href="#">Demo</a>
will show up as Demo(#)
<a href="/authenticate/">Authenticate</a> would show up as Authenticate (/authenticate)
But if I view the source from the ...
Howdy.
I want to build a rails query like the following. And would like to learn how so I can do it again on my own.
Pseudo Code:
@usersprojects = ?? Do I get record or just objects here? not sure?
SELECT *
FROM audit_log
WHERE project_id IN (@usersprojects)
IN the where IN () do I some how tell Rails to use the record.id?
thank y...
Hello, if I have the following:
@projects = Permission.where(["user_id >= ?", 21])
Results In:
[#<Permission id: 59, project_id: 13, user_id: 21>, #<Permission id: 59, project_id: 13, user_id: 21>]
I then what to use those project_id 's to QUERY as follows:
AuditLog.where({ :project_id => @projects }).limit(10)
But this errors?
...
I have a metric table that I expect to be very large. It has a polymorphic association so that it can belongs_to other models that want to record some metric. I typically index association columns like this to speed up association loading. I've heard people talking about joint-indexing this association. This looks like:
add_index :c...
Hello. I'm diving into Ruby on Rails and I'm experiencing a weird bug, using Rails 3.0.1 and Ruby 1.8.7. Using the generated scaffold code, my "Show" action is getting called when I'm expecting my "Destroy" action to get called. Here's the code...
routes.rb
webappdotcom::Application.routes.draw do
resources :projects
root :to =>...
is it
@cart have to put in :object ?
@cart.item have to put in : collection ?
...
active_scaffold :formats do |config|
format_order = Format.find(:all, :select => :format_order, :order => :format_order).collect(&:format_order)
format_order << format_order.size + 1 # I want only implement when new
config.columns = [:name, :format_order]
config.columns[:format_order].form_ui = :select
config.columns...
Recently I run a below command to start daemon process which runs once in a three days.
RAILS_ENV=production lib/daemons/mailer_ctl start, which was working but when I came back after a week and found that process was killed.
Is this normal or not?
Thanks in advance.
...
We're doing some prototyping of a new app and noticed that one of the actions were taking forever to load (80-120 seconds). As a lot of the processing doesn't need to happen on page load (we can request the data via Ajax later), I thought of using Process.fork to allow the page to return immediately, while the processing still happening ...
I'm working on this alerting service in Rails. And really, all I need to do is, when a user signs up, send a confirmation email to the user. And upon confirmation from the user, activate the user. I tried playing around with Matt Hooks' Authlogic email activation tutorial, but its really leading nowhere. So , any ideas how I can do this ...
I am in ruby 1.9.2, rails3.
So My website has some structures,
and I want to put menu in a middle of my webpage.
I am doing something like (within application.html.erb file)
blahblahblah
<div id="menu">
<%= yield :menu %>
<div>
blahblhablah
I have a file menu.html.erb which has menu structure for the site.
What can I do if I wan...
I am working on the drag and drop feature. I had a working code for that feature. Its written in rails 2.3.5. When I am shifted to rails 3, I used the same code. Actually drag and drop is working, but the position automatically changes in rails 3. In 2.3.5, position will not change.
<% for item in section_menu_items do %>
<li id='<%...
Is there a possibility to wrap checkboxes and radio buttons together in a unordered list ?
When not, How I can display them vertically ?
I know this is layout related, but still a programming question.
...
Hi folks,
in Rails 2.3 I always used
render :json => { :success => true, :data => @foobar}
to send JSON data to my frontend. In Rails 3 I'm using
respond_to :json
...
respond_with @foobar
But what I'm missing: I need the 'success' value within the JSON structure. What's the right way to inject such data into JSON response in Rails...
Wondering if there's a way I can avoid fetching the attachments as well.
...
How can I add :includes => :account to the current_user finder method in devise ?
Thanks
...
is it possible to edit the arrow which we get in the select tag (Rails)
I want to replace the arrow which we get in the select tag(drop down element) with my own image..
Is it possible to do the same?
...
I'm trying to call sanitize within a controller. Here's what I tried:
class FooController < ApplicationController
include ActionView::Helpers::SanitizeHelper
# ...
end
However, I'm getting this error:
undefined method `white_list_sanitizer' for FooController:Class
I searched around and people recommended switching the include l...
I got this some kind of permission error in my log. Everything was working fine previously, I have tested the photos controller of mine, and it worked well. So I started working on other controllers. Then somehow I found this error happening. Appreciate if someone could help.
Processing PhotosController#create (for 115.164.151.52 at 2...