I have a very simple controller set up:
class LibrariesController < ApplicationController
...
def create
@user.libraries << Library.new(params)
@user.save
render :json => "success!"
end
...
end
Basically, whenever I try to access the create method of LibrariesController using HTTParty.post I get a WEBrick::HTTPStat...
Hi.
I want to do a fairly simple implementation of a chat app using rails. from a theoretical standpoint I feel that ajax streaming pattern should be the way to go. However I am not sure, how it works and what are the potential disadvantages of this pattern?
Is there anything better that I can use. My requirement is to have four people...
I use inplacericheditor plugin and tiny_mce
Before asset_packager usage, this is how I include the files and they work well
<script src="/javascripts/patch_inplaceeditor_1-8-2.js" type="text/javascript">
</script>
<script src="/javascripts/patch_inplaceeditor_editonblank_1-8-2.js" type="text/javascript" </script>
<script src="/jav...
I installed rvm as root to setup an Ubuntu LTS 8.04 as a web hosting server for my rails apps.
rvm is installed in:
/usr/local/rvm
Everything works fine, gems installation included and users are able to use ruby and gem commands.
sudo gem install rails
My problem is that the gems EXECUTABLE DIRECTORY is not included in my PATH and...
Wow, switching to REST is a different paradigm for sure and is mainly a headache right now.
view
<% form_tag (businesses_path, :method => "get") do %>
<%= select_tag :business_category_id, options_for_select(@business_categories.collect {|bc| [bc.name, bc.id ]}.insert(0, ["All Containers", 0]), which_business_category(@business_ca...
Hello friends, I am a beginner to ruby on rails.But i am quite comfortable with php, Jquery. But i am not able to get the picture behind the screen in ajax in rails.
Can anybody suggest me a good book for ajax in rails or some good tutorials.
Right now i am working on Agile Web Development with Rails book.
...
I have the following routes defined:
map.resources :categories, :has_many => :downloads
map.resources :downloads, :member => {:go => :get}, :collection => {:tag => :get}
map.connect '/downlods/page/:page', :controller => 'downloads', :action => 'index'
map.connect '/categories/:category_id/downloads/page/:page', :controller => 'download...
Hi, I have a site thats served in 2 flavours, English and French. Here's some code
app/views/user/register.html.erb
-----------------
<% form_for .....>
<%= f.text_field :first_name %>
<% end %>
app/models/user.rb
------------------
class User < ActiveRecord::Base
validates_presence_of :first_name
end
Now to display ...
I have project on Rails (2.3.5). I add into environment.rb same sting:
config.gem "cucumber-rails",
run "rake gems:unpack:dependencies". Output of "rake gems":
[F] cucumber-rails
[F] cucumber >= 0.6.2
[F] term-ansicolor >= 1.0.4
[F] treetop >= 1.4.2
[F] polyglot >= 0.3.1
[F] polyglot >= 0.2.9
[F] builder >= 2.1.2
[F] diff-lcs >=...
Hello everyone,
I have a question about ruby on rails and the process of assigning variables using the params variable passed through a form
class User
attr_accessible :available_to_admins, :name
end
Let's say that I have a field that is only available to my admins. Assuming that you are not an admin, I am going to not display the a...
Hi All,
I want to know what the difference is between attr_accessible(*attributes) & attr_protected(*attributes) with examples if any.
I see many developers use these in their models. I Googled for the differences but I don't get exactly what they are. Could someone explain to me the importance and its necessity in different scenarios....
Hello I'd like to build a "Rails Brick" using a Sheevaplug from Marvell (O.S. is Ubuntu out of the box but You can install other distributions on It). It will be a home server and a silent, low cost (99$) low energy development machine.
I'd like to add rails RVM, lot of gems, git-based heroku like deployment, passenger + nginx. This way...
I have a site with Restful authentication as authentication plugin. I need to integrate Facebook connect. Facebook does not provide email address for the user (maybe only if user agrees if), and of course does not provide a password.
The main issue is that the User model has a lot of validates_** on those 2 fields (from Restful authent...
Hi,
I've a Rails 2.1.2 App hosted on site 5.
This App is running since 2 years and I want to migrate the site on heroku.
No pb to install the site on heroku, but what about the data?!
What is the best strategy to export from site 5 (I've phpMyAdmin) and then import to heroku?
Thanks
...
Hi guys,
I need to build a ruby daemon that will use the freeswitcher eventmachine library for freeswitch.
Since few days I as looking the web for the best solution to build a ruby daemon that will integrate my rails environment, specailly my active record models. I've take a look to the excellent Ryan Bates screencast (episodes 129 cu...
I'll show you my output here:
rake gems
(in /Users/jp/Sites/central/trunk)
- [F] authlogic
- [R] activesupport
- [F] builder
- [F] formtastic
- [R] activesupport >= 2.3.0
- [R] actionpack >= 2.3.0
- [ ] fastercsv
I = Installed
F = Frozen
R = Framework (loaded before rails starts)
Making sure fastercsv is i...
I've got something like this in my routes.rb:
map.resources :retailers, :has_one => [:invite_code]
map.resources :invite_codes, :member => {:redeem => :get}
and it isn't generating a route that I would expect:
http://localhost:3000/retailers/1/invite_code/redeem
Am I doing it wrong?
...
class User < ActiveRecord::Base
has_many :memberships
has_many :groups, :through => :memberships
class Group < ActiveRecord::Base
has_many :memberships
has_many :users, :through => :memberships
def moderators
# relationship_id is in the memberships table
self.users.find(:all, :conditions => ['relationship_id = ?', 1])...
Good day all.
I'm running into a bit of a problem getting a script running on my production environment, even though it works just fine on my dev box. I've verified that all the requisite gems and such are the same version.
I should mention that the script is intended to be run with the script/runner command.
Here is a super-condense...
I'm having two models: Snippet and SnippetComment. These also have their own controllers, as well as views. In /app/views/snippets/show.html.erb I have a form that starts like this:
<% form_for(@new_snippet_comment) do |form| %>
SnippetComment belongs to one Snippet, and a Snippet belongs to one User. This means that I have this routi...