Hi,
I am developing a Rails 3 app in a largely tabless capacity. I am using savon_model and ActiveModel to generate similar behaviour to ActiveRecord equivalents. Below is my code:
class TestClass
include Savon::Model
include ActiveModel::Validations
# Configuration
endpoint "http://localhost:8080/app/TestService"
namespac...
I have a rails 3 app that has 2 different UIs that both share the same model but have different UIs. Lets call these retailers and customers "sites". What is the best approach in rails 3 for creating a monolithic application to keep these two apps in one app. Should I just namespace the controllers, and change routing as such?
namesp...
Hello,
In my controller I'd like to do something like the following:
@book = Book.find(:all, :conditions = > [" created_at > with in the last 1 minute "]
if @book.nil?
# Just incase we didn't create a book, we'll initialize one
@book = Book.create()
end
@chapters = @book.chapters.build etc.............
* In sum, when the user i...
I've seen this posted a couple of times but none of the solutions seem to work for me so far...
I'm trying to remove a spurious  character from a string...
e.g.
"myÂstring here Â$100"
should be "my string here $100"
I've tried
string.gsub(/\194/,'')
string.gsub(194.chr,'')
string.delete 194.chr
All of these still leave the  in...
Should urls have pluralized words in them or singular?
I personally like:
/user/register
Is this against the 'convention'?
...
In my UserController I have:
def join
end
I have a join.html.erb in my /views/user/ folder.
My routes has a :
resources :user
When I go to:
http://localhost:3000/user/join
I get:
The action 'show' could not be found for UserController
...
I've got a Rails 2.3.5 app that I want to upgrade to Rails 3. In the Rails 3 upgrade Railscast, they suggest upgrading to 2.3.8 before going to 3. I've tried Googling but the information I find is all about upgrading to Rails 3. I found this question, which seems to suggest doing gem update rails and rake rails:update, but wouldn't these...
I want the following urls for my UserController:
localhost/user/join
localhost/user/login
localhost/user/user_name (this can be any name in here, it should fire the 'profile' action)
Then within the /user/user_name_here/ folder I want:
/user/user_name/blah1/
/user/user_name/blah2/
/user/user_name/blah3/
It seems doing resources :us...
Hey guys ive got the following code in my Model
require 'RMagick'
class Upload < ActiveRecord::Base
belongs_to :card
has_attached_file :photo,
:styles => {
:thumb => ["100x100", :jpg],
:pagesize => ["500x400", :jpg],
},
:storage => :s3,
...
I am working on integrating Omniauth with my new Facebook application, and I am looking through the rather sparse documentation to understand if it gives simple ways to access the graph API... I am moving from Koala which was pretty simple.
Has anyone out there used Omniauth for this yet? I want to get photos from the users' albums, ...
Am working my way thru Ruby on Rails Tutorial: Learn Rails by Example. I'm in the section entitled Mostly Static Pages.
I get an error after I create an HTML page in the public directory which is called public/hello.html and should appear as in Figure 3.3. My problem is that when I try to create the page and make it appear at localhost:...
I have a scenario outline with multiple scenarios. I'd like my Before hook to run only once so I can bootstrap the ActiveRecord objects I need to run against all of the scenarios. The problem is if I use
Before do
# my code here
end
This will execute before each Scenario. Is there anyway to run it once for the entire Outline?
...
Let's say I have an Foo ActiveRecord model with fields foo_id, foo_name and foo_description.
After doing something like @foo = Foo.find(1), is there any method "model_fields" such that :
@foo.model_fields() would return the array ["foo_id", "foo_name", "foo_description"] ?
Thanks for the help,
Nicolas.
...
The locale switching on my site is behaving strangely. I decided to go with a scoped route for switching locales:
scope ":locale" do
devise_for :accounts
resources :eventos
root :to => "eventos#index"
match '/sign_in' => "Devise::Sessions#new", :as => :sign_in, :constraints => { :method => "get" }
match 'sign_in' => "Devise...
I had Rails 2.3.5 installed, and wanted to upgrade to 2.3.10 as a stepping stone to Rails 3. I thought running gem install rails -v=2.3.10 would install 2.3.10 and keep 2.3.5 as well. But now when I do Rails -v, it only lists Rails 2.3.10. How can I install different versions of Rails and keep the existing ones?
...
I am getting a routing error: No route matches "/deccom_tasks/update/1" with {:method=>:put}
I'm not sure why I am getting a routing error for a route that usually works.
Route:
map.resources :decom_tasks, :collection => {:sort => :post, :deactivate_task => :get, :reactivate_task => :get}
Controller:
def update
@task = Task....
Here is what I want to do:
<%= link_to "Approve", brand_user_brand_roles_path(@brand),
:with => "forms[0]['user_brand_role_role_id'].value", :method => "POST", :remote => true %>
I know that this doesn't work. I want to call a controller method remotely, including as a parameter a value that is selected in a field other than what ...
Hi all,
I'm a student working on a project where a need to integrate my iPad (or iPhone) application with a Rails Web App, populating the database from the iOS side and displaying the contents in the web app. I've found ObjectiveResource, but I've had difficulty getting it up and running (went through the getting started, and had the si...
Presumably if Cucumber is not seeing what I expect it to see, it must be seeing something else. Mirroring in my application what I think the same steps are, I get the desired output.
This is a "signing in" feature. It appears that sign in is failing in the test. But unless I can see the error message, I don't know why it's failing!
...
bundle exec /Users/new2/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -S /Users/new2/.rvm/gems/ruby-1.9.2-p0@rails3tut/gems/rspec-core-2.0.1/bin/rspec --autotest '/Users/new2/work/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb'
/Users/new2/.rvm/gems/ruby-1.9.2-p0@rails3tut/gems/rspec-core-2.0.1/lib/rspec/core/configuration....