Displaying 20 results from an estimated 20000 matches similar to: "rails, ajax, json, and script"
2010 Dec 01
6
Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
I just installed my RoR application on my ISP''s server.
This is a Cpanel environment and it creates a .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^xyz.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.xyz.com$
RewriteRule ^(.*)$ "http\:\/\/127\.0\.0\.1\:12001\/$1" [P,L]
in a public_html directory. (I changed my domain name in the text above
to xyz because we are
2011 Sep 14
5
rjs error TypeError: element.getElementsByTagName is not a function in rails 3+jquery
hi,
i am using rails 3.0.10
i am trying with sample application for searching data from table and
updating
my search.html.erb file is
<%= form_for (@employee) do |s|%
<div id ="search_details">
<%= s.text_field :name%>
<%= s.text_field :emp_id, :onfocus =>
''sal(document.getElementById(''employee_name'').value);''%>
2012 Jun 09
7
ActiveRecord::AssociationTypeMismatch in UsersController#update
Hi
Im trying to link my User model to a Teams model. I seem to be getting
the following errors. Any help would be great as Im just new to RoR
Thanks
error
ActiveRecord::AssociationTypeMismatch in UsersController#update
Team(#2183395560) expected, got String(#2174675960)
app/controllers/users_controller.rb:67:in `update''
app/controllers/users_controller.rb:66:in `update''
2012 Jun 13
7
Cmd line interface for ruby on rails app
Hi,
I have a rails app running which provides an interface to create/update
data stored in a DB. How do i develop a cmd line interface to do the
same i.e i should be able to retrieve/update data to a DB.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email
2013 Jan 07
4
JSON::ParserError in controller
Hi All
I''m trying to build an application which requires to scrap information
from a webpage. On trying to perform the action, I get an error while
trying to convert the html data to JSON. Has anyone experienced this
before and if so can you please tell me how to solve this problem ?
Please see below for code snippet and error log.
Thanks in advance
Anush
require
2011 Aug 09
4
Nesting select and text_field in radio_button
I''m creating my first Rails app and need an idea creating forms.
I have Meeting model with place attribute.
I want to have two fields for Meeting.place = one would be select with
places from other meetings or text_field if the place is being used
first time. User would be selecting radio_button of which field he has
used.
So is there any way to nest select and text_field within 2
2011 Aug 25
7
How to safely embed JSON object in HTML document
Hi all,
I''m working on a Backbone.js single page app with Rails 3.1, and in an
attempt to save on HTTP requests, I want to embed initial data set in
a HTML document that is sent back to the browser after successful
login.
I was thinking I can simply convert my ruby object to JSON, then HTML
escape resulting string of JSON, and then use that as a value for
JavaScript variable. Something
2011 Oct 25
7
additional model attributes
Hi,
i have a "place" model with 2 columns (id, name).
I''m calling an external api which gives me data to create a new place
object.
I would like to add the address from the external place to the place
object and render it as a json result, without storing it in the
database.
i don''t get any errors, but the address never shows up within the json
output. i''ve
2012 Jun 15
1
Problem with active resource(500 internal server error)
Hi,
I have a rails server running. I wanted to connect to this using
activeresource.
Executing this code
Class Buildclient < ActiveResource::Base
self.site = "http://localhost:3000/builds"
end
builds = Buildclient.find(:all)
puts builds (## printed nil)
On the rails server terminal i see
Started GET "/builds/buildclients.json" for 127.0.0.1 at Fri Jun 15
10:34:05
2010 Aug 14
10
Redirecting after logging in
Hey everybody,
I''m trying to make an example of a small networking site, and when I log
in a user, it should redirect and show his profile, but I get the
following error:
NoMethodError in User#index
Showing app/views/user/index.html.erb where line #5 raised:
undefined method `screen_name'' for nil:NilClass
Extracted source (around line #5):
2: Your basic information
3:
2010 Mar 07
8
Parsing XML file with no style info with Hpricot
Hello,
I''ve been trying for hours to parse an XML using Hpricot. Usually it''s
not a problem. Here''s my simple code:
#This works and outputs the proper xml data
@url1 = ''http://www.sportingnews.com/stories/sportingnews/MLB/rss.xml''
@page1 = Hpricot(open(@url1))
<%= @page 1 %>
#This does not work, and I''m scratching my head
@url1 =
2012 Jul 07
18
Problem processing text file after uploading
I''ve got a web-app currently partially working. The user uploads a .txt,
.docx or .doc file to the server.
Currently the model handles those files, saves some metadata (the
extention and orig filename) then saves the file to the hard drive. Next
it converts the doc and docx files to plain text and saves the output to
a txt file.
My problem is I want to copy the plain text contents of
2012 May 16
7
Rails 3.1.0 cannot connect to sqlite database on Mac Lion
I''m running Rails 3.2.3 on Mac Lion with sqlite 3.7.7 and ruby 1.9.3p125. I need to back down rails to 3.1.0 for a project but when I do that a simple index page give me a
ActiveRecord::ConnectionNotEstablished
error.
Rails 3.2.3 works, 3.1.0 not. Any ideas?
Just to show you it''s nothing fancy....
Gem file is only:
source ''https://rubygems.org''
gem
2010 Jun 10
4
rails removes newlines and spaces from ajax requests
Hi
I have an app which posts an ajax request with with text area content,
but when it does post it it gets all the newlines and multiple spaces
removed (need to use multiple spacing for use with markdown code
snippets)
I''ve created a sample app which you can see here http://test.42horizons.com/test,
View it in IE 8 and both requests remove line spaces and new lines,
view it in firefox
2011 Aug 25
3
ActiveRecord searching in batch (with find_by_sql)
I have an issue where I am getting a large number of records from the
database and I cant afford to keep it in the memory due to performance
issues.
Therefore using the following would be ideal,
User.find_each(:batch_size => 5000, :start => 2000) do |user|
NewsLetter.weekly_deliver(user)
end
however,
I would like to use find_by_sql since my query is user defined. Question
is, is it
2010 Jul 02
17
Doesn't work erb engine
I''m new in RoR:)
I have controller and view (/app/controllers/greeting_controller.rb
and /app/views/greeting/index.rhtml /.erb/.html.erb - doesn''t match).
greeting_controller.rb source:
class GreetingController < ApplicationController
def index
@message = "Hello world!"
end
end
index.rhtml source:
<html>
2012 Sep 21
9
Using PostgreSQL with RoR on windows. Help!
So I just got involved in a huge team project with RoR and PostgreSQL.
But I can''t find anywhere on the internet to find a proper way to put
them together. I did find one but it is for iOS :-/
http://railscasts.com/episodes/342-migrating-to-postgresql?view=asciicast
I have them both installed and the gem package for postgres also. the
database.yml is already configured. I just
2011 Dec 02
20
Need Some Guides on Solr with Rails.
Hi Everyone,
I am pretty new to Rails. I have very little idea about everything. But
for my new project i have been asked to do some research on Solr search
and implement it on Rails. Please provide me some link on tutorials and
guides about Solr on Rails. Trouble is... have to do it by tomorrow.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are
2012 Sep 04
5
Associations and Math between Models
I''ve setup two models, 1 and 2, that are associated by
has_and_belongs_to_many. I''m trying to get an attribute from model_1 to use
in a method in model_2. When I use the code below, I get an error saying
''undefined method model_1_id''. What am I missing? Thanks!
Model_2.rb
Class Model_2 < ActiveRecord::Base
...
has_and_belongs_to_many :model_1
def
2009 Apr 05
5
Use a value from a different model
Hello,
I cannot find the issue and it drives me crazy :(
let''s simplify. I have 2 models: saving and purchase_type
a *saving* corresponds to a *purchase_type* e.g. new sourcing or
renegotiation
a saving has exactly one purchase_type and a purchase_type has many
savings.
when I try to display the list of savings and their purchase type
(name, not Id), i get the dreaded "You have a