I first used Rails when it was not so well known about, in 2005. I did some experimental work with it but it has languished due to lack of time.
I'm now thinking of persuing the original idea again (with a new implementation) and when researching the latest Ruby and Ruby-on_Rails versions I see Ruby 1.9.2 and a Rails 3.0 beta.
I haven'...
Hi,
I have a simple model
class Ad < ActiveRecord::Base
has_many :ad_items
end
class AdItem < ActiveRecord::Base
belongs_to :ad
end
I have an "ads/new" view, that shows me the form for creating the new ad and adding some items to it
The .html.erb code is like a following:
<% form_for @ad, do |ad_form| %>
<!-- some html -->...
Hi all,
I am a seasoned .net developer and using VS.net all the time. Now, I would like to learn Ruby on Rails using Emacs. Since I'm pretty new to Linux, it would be great if someone show me step by step tutorial to setup emacs for RoR develpment.
...
Hi -
I have a controller action that returns JSON data for api purposes, and plenty of it. I want to be able to inspect it in the browser, and have it nicely indented for the viewer. For example, if my data is
data = { :person => { :id => 1, :name => "john doe", :age => 30 }, :person => ... }
I want to see
{ "person" :
{
...
Hi Everyone,
I have created a custom action within one of my controllers as follows:
# GET /kases/discharge/1
# GET /kases/discharge/1.xml
def discharge
@kase = Kase.find_by_jobno(params[:id])
respond_to do |format|
format.html { } # discharge.html.erb
format.xml { render :xml => @kase }
format.pdf { ...
I'm working on Ruby on rails 2.3.4 and I'm trying to develop a Sort feature on my website's search page(its url is /anuncios/buscar).
What I tried is to create a "map" on routes file:
map.search_filter_relevance "/anuncios/buscar", :controller => 'announcements', :action => 'search_filter_relevance'
Then, I wrote this on the view:
<...
Hi, I have just started learning Ruby on Rails and I really want to do a project on Web Spiders. I am really looking forward for good tutorials in ruby on rails. Could you help? Thanks.
...
I have a jruby rails app and I've just started using bundler for gem dependency management. I'm interested in hearing peoples' opinions on deployment strategies. The docs say that bundle package will package your gems locally so you don't have to fetch them on the server (and I believe warbler does this by default), but I personally th...
I'm trying to implement a ping to an xmlrpc server written in PHP under CodeIgniter. The system currently works as expected when receiving pings from WordPress-based blogs, but I'm unable to generate a successful ping from Rails. The code I'm using to generate the ping is:
require 'xmlrpc/client'
server = XMLRPC::Client.new("digital466....
I am trying to limit a user of my application to voting (liking in this case) a an answer to a question a particular number of times. I am successfully stopping the collection of the user_id but the record keeps getting created. I need for the validation to actually block the creation of the record in the likes table.
As you can see ...
I feel like each time I start a new Javascript-heavy application, I begin to bumble around more and more as additional client-side code is written. The code structure of a Rails app is pretty well dictated by the framework, but developers usually invent their own structure for their Javascript and AJAX interactions.
I'm looking for web ...
I've written a rails module that generates some javascript for a google map. As the user makes changes on the webpage, I use observe_field to call back to the server to regenerate the map's javascript (without updating the whole page). I'm having trouble finding a good way to insert the new javascript into the page. I've tried
<div id=...
Hi,
i implementing a products catalog, that looks, like this:
group 1
subgroup 1
subgroup 2
item 1
item 2
...
item n
...
subgroup n
group 2
subgroup 1
...
subgroup n
group 3
...
group n
The Models:
class CatalogGroup < ActiveRecord::Base
has_many: catalog_items
has_many :catalog_item...
Is there any way I can route assets inside of my css to where the rest of the views are pulling them? I mean, inside the CSS can I call url_for or css_for or something like that in order to have the images go through the assets router?
Thank you in advance!
...
Hi,
In Rails is there a way to get the URL to the image (going through the assets_host) and just return the URL of the image? I want to use assets_host data in my Javascript, but I just need to insert the URL into the JS, not the whole image_tag.
Thank you in advance!
...
How do you folks retrieve all objects in code upfront?
I figure you can increase performance if you bundle all the model calls together?
This makes for a bigger deal, especially if your DB cannot keep everything in memory
def hitDBSeperately {
get X users
...code
get Y users... code
get Z users... code
}
...
In my Rails application there is a model that has some has_one associations (this is a fabricated example):
class Person::Admin < ActiveRecord::Base
has_one :person_monthly_revenue
has_one :dude_monthly_niceness
accepts_nested_attributes_for :person_monthly_revenue, :dude_monthly_niceness
end
class Person::MonthlyRevenue < Active...
I'm working with Ruby on rails 2.3.4 and I'd like to have a link that executes an action when clicked.
The relevant part of the routes.rb file looks like this:
map.search_filter_relevance "/anuncios/buscar", :controller => 'announcements', :action => 'search_filter_relevance'
My view(it's the model's index page) looks like this:
<%=...
Hi,
I have some models such as:
class User < ActiveRecord::Base
acts_as_authentic
end
class Admin < User
end
class Superadmin < Admin
end
And some controllers such as:
class UserSessionsController < ApplicationController
def new
@user_session = UserSession.new
end
def create
@user_session = UserSession.new(params[...
I have the following setup:
class Publication < ActiveRecord::Base
has_and_belongs_to_many :authors, :class_name=>'Person', :join_table => 'authors_publications'
has_and_belongs_to_many :editors, :class_name=>'Person', :join_table => 'editors_publications'
end
class Person < ActiveRecord::Base
has_and_belongs_to_many :publicat...