I used paper clip in my web application, I use this to make a new product:
<% semantic_form_for @product do |f| %>
<% f.inputs do %>
<%= f.input :title %>
<%= f.input :price %>
<%= f.file_field :photo %>
<%= f.input :category , :include_blank => false %>
<% end %>
<%= f.buttons %>
<% end %>
And th...
I am experimenting with Ruby and Rails. I like Ruby, but not Rails. I have Java/PHP background, I have used some frameworks, but never totally liked any of them.
Anybody using Ruby to build web apps, but not any of the frameworks? (rails, merb etc). If yes, can you point me to some resources to learn it?
...
For the life of me, I can't figure out (or find the right text to search) how to create a link that looks like this:
<a href="/publisher" class="button first"><span>This text will be hidden</span></a>
There's a similar example in the link_to API, but it doesn't quite get to what I need. I don't want my anchor tag to have any text (all...
does rails activerecord have any support for prepared statements? best I can tell -no.
...
This is possibly a newbie question, but I'm not sure what terms to search for.
Say I have a CUSTOMER object, and I want to send a MESSAGE to that customer.
What I would do first is add a SENDMESSAGE action on the CUSTOMER controller, which builds the message object. (Assume this is the right thing to do?)
In this instance however, ra...
Hi,
I just switched to mac, I was previously working on Linux.
I am trying to use posgresql for my project
When I start the server, it works fine.
Nevertheless when I use rake:db:migrate, it fails saying:
Please install the postgresql adapter: gem install activerecord-postgresql-adapter (no such file to load -- pg)
I have the gem "pg...
I'm sure this is a very simple question, but I'm just a newbie so...
I have a model, Game, which has_many :piles. Pile, in turn, has_many :cards. I'm able to populate the Piles and Cards at creation of the Game, so my code at present looks something like:
class Game < ActiveRecord::Base
has_many :piles
def after_create
1.upto(...
Is it possible to set the cookie domain to something other than the current domain when a session is created with Authlogic?
When a new account is created from our signup domain, I'd like to redirect the user to their subdomain account and log the user in.
Current controller:
def create
@account = Account.new(params[:account])
if ...
How do I add children to a parent using the awesome_nested_set plugin?
I have a model, Unit, which is a nested set. I'd like to add sub-units. Within the edit view, how I let the user add children (sub-units) to the parent (unit)?
...
I've come across conversions of the form Array(value), String(value), and Integer(value) on occasion. It appears to me that these are just syntactic sugar for a call to the corresponding value.to_a, value.to_s, or value.to_i methods.
So I'm wondering:
Where/how are these are defined? I can't find them in Object, Module, Class, etc
A...
I'm looking to build a basic Facebook application with Rails. What are the resources (books podcasts, screencasts, blog articles etc) that you'd recommend?
(One answer per post please, and up-vote instead of duplicate).
...
Here is code on view in FeesController "show" action template:
<div id="payers_controls">
<%= link_to_remote('New payer',
:update => "payers_controls",
:url => new_payer_url)
%>
</div>
Here is new.rjs - belongs to PayersController "new" action
page.replace_...
I come from a traditional programming background by which I mean C, Java, C#, C++ and a little python and VBA.
Now I'm trying to create a small CRUD application for the purpose of taking a form and turning it into an online form and database for later querying.
My initial thinking seems to lead me to Ruby on Rails given the fact that...
I have two models
class Subscription < ActiveRecord::Base
belongs_to :client
end
class Client < ActiveRecord::Base
has_one :subscription
end
but when I try to create a parent from the child e.g. sub.build_client the foreign key does not get set e.g.
>> sub = Subscription.new
=> #<Subscription id: nil, token: nil, user_id: nil, c...
I wish to implement Markdown in a Rails CMS comments system using a Ruby library such as Maraku or Kramdown. I need to restrict which Markdown features the users can submit. In this system users aren't allowed to insert to images, html, or perform any heavy editing, but emphasis and hyperlinks are okay.
Essentially, I wish to create som...
I am looking for a tiny tool/script/plugin to visualize my Rails schema.rb file so that our project does not have to maintain a separate diagram manually.
Do you have any experiences on that subject?
...
How can I create a web service using Ruby on Rails? Please give an example.
...
Some of my controller actions use the request.host parameter in their logic. In integration tests I can use the host! method to set the host. How can the same be achieved in functional tests?
...
I'm making a Rails template file as introduced below:
http://asciicasts.com/episodes/148-app-templates-in-rails-2-3
I have a big file I want to make, so instead of doing:
file "bigfile.txt", <<-EOF
content of the file...
EOF
I want to read the content from another file. What I have now is:
file "public/stylesheets/sass/960.sass...
Anyone know how to get assert_response to work with webrat using selenium? I keep getting
NoMethodError: undefined method `response_code' for nil:NilClass
Here's my test:
def test_basic_page_load
visit root_path
click_link "register"
assert_response 200
end
Here's the error:
==> Waiting for Selenium RC server on port 4444.....