Hi, I am trying to follow this railscast tutorial for authlogic - and it points to the source here -
I have git installed - how do I replicate the source onto my localhost so that I can follow the tutorial like in the screencast?
Thank you!
...
I'm using Mechanize to extract the links from the page.
To ease with development, I'm using fakeweb to do superfast response to get less waiting and annoying with every code run.
tags_url = "http://website.com/tags/"
FakeWeb.register_uri(:get, tags_url, :body => "tags.txt")
agent = WWW::Mechanize.new
page = agent.get(tags_url)
page.lin...
I want to build a search engine that is similar to Wolfram Alpha. I want to insert a query and receive a response from a dedicated database, or multiple databases for multiple responses. Up until this point I know HTML + CSS, but I am mostly focused on design. I want to expand my skill set and create a web application like this but on a ...
At a glance they seem to be pretty much the same solution to the same problem, but Jammit must have some key difference or improvement that I haven't picked up on, or its author would have just used asset_packager. :-)
Can anyone enlighten me?
...
I have written a simple blog plugin (it's actually a rails engine). It is designed to be installed into an app that already has a user model set up.
In order to save me from having to open up my User model and manually inserting "has_many :posts", I'd like to write a rake task that automatically does this for me.
If I were to package ...
Hi.
I am using button_to and link_to form helpers in Rails. I need to set an html attribute based on a condition in code. More precisely, I need to disable a button_to component only if a certain condition is true.
How can I achieve that? code snippet below.
<%= button_to "Submit", "#", :id=> "submit", :class => "button_white_big", :d...
I recently upgraded my rails from 2.0.1 to 2.3.3 and since then have been seeing erratic behavior with the restful_authentication plugin. Below are 3 of the errors and stack traces that I got some of the time, but not all the time. I get these on separate requests, but the code-editing here put them all together.
I got the latest versio...
I have a model named Tickets that being saved to the database even when
invalid. This is stopping me from using validations to help prevent
duplicate data being saved to the DB. In script/console
>> Ticket.last.valid?
=> False
>> Ticket.first.valid?
=> False
If I try to see what errors are associated with this invalid object
>> Tic...
i am just creating a simple new action in rails, but when i view it in browser i get this error :
undefined method `render' for #<Template:0x9e9993c>
the new method is :
def new
@template = Template.new
end
i have new.html.erb in the folder ! whats the problem ?
...
I'm looking to define a method that lets me pass options; something like:
@user.tasks(:completed => true)
I thought something like this would work in my user model (but it's not):
User.rb model
def tasks(options)
tasks.find(:all, options)
end
How would I define the method correctly to let me use @user.tasks(:completed => t...
Hi, I'm looking for a way to determine image orientation preferably with Paperclip, but is it even possible or do I need to user RMagick or another image library for this?
Case scenario: When a user uploads an image i want to check the orientation/size/dimensions to determine if the image is in portrait/landscape or square and save this...
I have two models: CreditCard and BlacklistItem::CreditCard. If I search for a BlacklistItem::CreditCard first, I get the expected behaviour:
>> BlacklistItem::CreditCard.find(:all).first
=> #<BlacklistItem::CreditCard id: 5, *snip* >
>>
If I search for a CreditCard first, when I go to look for BlacklistItem::CreditCard items later ...
I have an app with an Account model. Each Account belongs_to a sport, which I would usually have as a Sport model and in the DB. But as this isn't really something that will change and is not administered by the end users I thought that it might be better to put it as an integer column in the Account model and map to a hash using a clas...
How can I validate a number within a range dynamically using existing data?
For example - I have certain discounts on bulk ordering of products. If a customer buys 10-50 units they get X off and if they order 51-200 units Y off.
How can I validate this so that users can't put in quantity discounts over the same range?
...
Is it possible to automatically assign a specified layout template to a particular controller and all of the resources nested within it, as specified in routes.rb? This layout should apply only the specified controller views and those nested within it; it does not need to be applied to every view within the application, as application.ht...
Hi
I need to find an elegant solution to scoped finds based on access control rules. Essentially I have the following setup:
Users
Customers
AccessControl - Defines which user has access to another users data
Users need to be able to access not just their own customers but also shared customers of other users.
Obviously something lik...
I'm using rails.vim and I love how you can use ctrl-x ctrl-u in insert mode to autocomplete long method names like distance_of_time_in_words and accepts_nested_attributes_for. But for some reason it doesn't work in haml files and I can't seem to figure out what's wrong or how to fix it.
:help i_CTRL-X_CTRL-U says the autocompletion is u...
Here is my data model from my application:
id :integer(4) not null, primary key
spam :boolean(1) not null
duplicate :boolean(1) not null
ignore :boolean(1) not null
brand_id :integer(4) not null
attitude :string not null
posted_at :datetime not null
Attitude could ...
I have model called test, and test can have many tests, and should be able to have a reference to it's parent test if it exists. EG
test <-- parent doesn't exist
test
test
test
test
test
test
test <-- parent doesn't exist
i've seen a couple of possible solutions with examples before 2.3, but how models handle references seems t...
I'm aggregating RSS feeds using FeedTools.
I followed this tutorial: http://simonwoodside.com/weblog/2008/12/7/ruby%5Fon%5Frails%5Ffeedrss%5Faggregator/ and everything functioned fine.
The problem is I want to filter some of the hashes that exist within the array [:items] from inside the parsed feed hash.
Here's the RSS cached feed obj...