I'm new to RoR, but familiar with MVC, REST, used a lot Symfony, Yii, CI and other smaller php frameworks. Now I want to learn Ruby on Rails.
Please help me find a complete tutorial for "dummies", which describes creating web application from scratch on RoR. This is like Symfony's Askeet and Jobeet tutorials.
Thanks for any help!
Upda...
I've a simple rating system setup in a blog model. I use a custom method to increase rating, which is integer in blog db.
def increase
@post = Post.find(params[:id]).increment!(:rating)
if logged_in?
current_user.increment!(:votes)
end
flash[:notice] = "Thanks for rating"
redirect_to posts_url
end
Right now, I can vote a...
I come from a desktop programming background. I wanted to dive seriously into the web programming scene. I looked around and I think using a well established web framework would be the way to go. From what I see Django and Ruby on Rails are really popular.
So I just wanted to know which of these or any other is a good choice for me. so...
I want to build a basic Social networking site in Rails.
Can you please suggest me some ebooks for that or any web resource.
Thanks
...
I use this code to upload photos, I find that it is not successfully upload photo, but other content can be updated.
<% semantic_remote_form_for(@product, :html => {:multipart => true}) do |f| %>
<% f.inputs do %>
<%= f.input :title, :label => "Name" %>
<%= f.input :category , :include_blank => false , :label => "Catego...
Hello!
I am trying to use FactoryGirl instead of default fixtures in edge Rails 3. I used
http://github.com/pjb3/rails3-generators
and tried to do the replacement as adviced in
http://paulbarry.com/articles/2010/01/13/customizing-generators-in-rails-3
this way (config/application.rb)
config.generators do |g|
g.orm :ac...
I would like to enumerate all the URLs in a text string, for example:
text = "fasòls http://george.it sdafsda"
For each URL found, I want to invoke a function method(...) that transforms the string.
Right now I'm using a method like this:
msg = ""
for i in text.split
if (i =~ URI::regexp).nil?
msg += " " + i
else
...
I have an invoicing system that manages debits and credits. Basically the invoice amount is obtained by the sum of its debits and the balance is derived by taking the sum of its credits and subtracting it against the total amount.
I'm doing this with four models.
Invoice
Line Item
Debit
Credit
The way it works is via a join model (L...
I know that the after the create or update methods is done, they have the method like this
respond_to do |format|
format.js
end
Since I change my form from remote form to non remote form, so I won't use the format.js anymore, I just want to refresh the page, after the user create/update a product, so I have this code:
respond_to ...
I have a controller called store_controller, and views for store.
But the store doesn't have the model, but I want to use store_path in the code. How can I add the store_path in routes.rb?
...
i have some problems when i try to check urls after get them from gsub method.
ex
from the console:
('http://ale.it' =~ URI::regexp).nil?.to_s
=> "false"
and it works fine
but if i launch this:
"http://ale.it".gsub(/http[s]?:\/\/[^\s]+/, ('\0' =~ URI::regexp).nil?.to_s)
=> "true"
it doesn't work.
How can i do, for get correct...
How can I do to run an application in www.domain.com/folder1 and other in www.domain/folder2, using heroku?
...
I have a large-ish array (~400 elements) of ActiveRecord objects that I need to convert to XML. I've used array.to_xml for convenience, but it's very slow -- about 20 seconds when the server is busy, and about 5 seconds when idle.
I've just run a few benchmarks while the server was idle, and found that:
the ActiveRecord query (comple...
Hello all,
I have two models: Company and Person
class Person < ActiveRecord::Base
belongs_to :company
end
class Company < ActiveRecord::Base
has_many :people
accepts_nested_attributes_for :people, :allow_destroy => true, :reject_if => proc {|attrs| attrs.all? {|k,v| v.blank? } }
end
And my HTML form partial for new and edit a...
Hello, when trying to run:
rake db:create
I get the following error:
undefined method `quote_ident' for PGconn:Class
Having googled for a solution, it seems by adding:
def PGconn.quote_ident(name)
%("#{name}")
end
to config/initializers/new_rails_defaults.rb should solve the problem, but I'm still getting the error! Any suggesti...
I'm starting a hobby (non-revenue) project using Ruby on Rails. I've done a fair amount of development in Rails using Postgresql, and I can make a pretty good imitation of normalized schema. However, Mongrodb looks shiny and new. What better for trying out something new than a hobby project?
Think back to when you started using Mongo...
So, I have two models, User and Thing.
User
has_many :things
end
Thing
belongs_to :user
end
Thing has a date associated with it. A user might add zero things one day, and 4 the next, and 7 the day after that, then zero for a few days. You get the idea.
Now, what I'd like to get is an array of values for the last 7 days. How many...
I was hoping I could get some help optimizing this query for a rails site:
Vacation
has_many :departures
has_many :photos
Departure
belongs_to :vacation
Photo
belongs_to :vacation
I need to find a list of vacations ordered and displayed by departure. So if a vacation has two departures, it should show up in the list twice (once for...
How can i have a link on a page that takes the user to another URL and passes along a parameter and on the target url how can we pick up that parameter.
usually I add links like following:
<%= link_to "Add Product", '/pages/product' %>
But how can I send parameters along with this url? Can I pick them in the target action by using p...
I have a rails application which lets you create a new account using FB connect, the issue that I' having (and many others) is how to get a hold of the infinite session key after the user has granted 'offline access'
The user flow:
Click "Connect" to authorize my application
I get a temporary session key (as expected)
I prompt the use...